andremm / typedlua

An Optional Type System for Lua
563 stars 53 forks source link

Lua error on file or filter #99

Closed Veltas closed 8 years ago

Veltas commented 8 years ago
local f = io.open("wednesday")
f = f or io.stdin

Causes error:

lua: /usr/local/share/lua/5.3/typedlua/tltype.lua:1192: trying to convert type to string but got TProj
stack traceback:
        [C]: in function 'error'
        /usr/local/share/lua/5.3/typedlua/tltype.lua:1192: in upvalue 'type2str'
        /usr/local/share/lua/5.3/typedlua/tltype.lua:1183: in function </usr/local/share/lua/5.3/typedlua/tltype.lua:1127>
        (...tail calls...)
        /usr/local/share/lua/5.3/typedlua/tlchecker.lua:1399: in function </usr/local/share/lua/5.3/typedlua/tlchecker.lua:1348>
        (...tail calls...)
        /usr/local/share/lua/5.3/typedlua/tlchecker.lua:1885: in function 'typedlua.tlchecker.typecheck'
        /usr/local/bin/tlc:142: in main chunk
        [C]: in ?
mascarenhas commented 8 years ago

I have to rewrite check_assignment and related functions to get rid of the current technical debt, but I managed to shoehorn a fix for this. The related examples/issues/issue99.tl file has examples of what are the expected semantics of assigning to a variable that is linked to other variables (it breaks the link).