teal-language / tl

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

Record redeclaration error highlights wrong position #542

Closed saecki closed 2 years ago

saecki commented 2 years ago

Teal version: 0.13.2

This code:

local record Outer
    record Path
        text: string
    end

    record Path
        text: string
    end

    record Other
        field: integer
    end
end

produces the following error:

========================================
1 syntax error:
repr.tl:10:5: attempt to redeclare field 'Path' (only functions can be overloaded)

Which is the Other records position instead of the second Path record.

hishamhm commented 2 years ago

Thanks for the report! I pushed a fix.

saecki commented 2 years ago

Wow, that was quick!

hishamhm commented 2 years ago

sometimes we're lucky and the fix is easy :)