teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.1k stars 108 forks source link

improve error message for redefined functions #566

Closed catwell closed 1 year ago

catwell commented 1 year ago

Consider this code sample:

local function foo() end
local function foo() end

Before this change:

========================================
3 warnings:
invalid.tl:2:1: redeclaration of variable 'local' (originally declared at 1:1)
invalid.tl:1:1: unused function foo: function()
invalid.tl:2:1: unused function foo: function()

After this change:

========================================
3 warnings:
invalid.tl:2:1: redeclaration of function 'foo' (originally declared at 1:1)
invalid.tl:1:1: unused function foo: function()
invalid.tl:2:1: unused function foo: function()
github-actions[bot] commented 1 year ago

Teal Playground URL: https://566--teal-playground-preview.netlify.app

hishamhm commented 1 year ago

good catch! thanks for the fix!