andremm / typedlua

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

Crash when running with -s #42

Closed hishamhm closed 9 years ago

hishamhm commented 9 years ago

Running typedlua master branch (commit f4a0fb6ae0)

Testcase:

local function foo(): ({integer:integer}, boolean) | ({integer:integer}, nil)
end
local flags, err
flags, err = foo()

I get this:

lua: /Users/hisham/projects/github/typedlua/typedlua/tltype.lua:1058: attempt to concatenate a nil value (field 'tag')
stack traceback:
    /Users/hisham/projects/github/typedlua/typedlua/tltype.lua:1058: in upvalue 'type2str'
    /Users/hisham/projects/github/typedlua/typedlua/tltype.lua:1056: in upvalue 'type2str'
    /Users/hisham/projects/github/typedlua/typedlua/tltype.lua:1052: in function </Users/hisham/projects/github/typedlua/typedlua/tltype.lua:1011>
    (...tail calls...)
    ...s/hisham/projects/github/typedlua/typedlua/tlchecker.lua:576: in upvalue 'check_return_type'
    ...s/hisham/projects/github/typedlua/typedlua/tlchecker.lua:989: in function <...s/hisham/projects/github/typedlua/typedlua/tlchecker.lua:949>
    (...tail calls...)
    ...s/hisham/projects/github/typedlua/typedlua/tlchecker.lua:1550: in function 'typedlua.tlchecker.typecheck'
    /Users/hisham/projects/github/typedlua/tlc:123: in main chunk
    [C]: in ?
andremm commented 9 years ago

I just pushed a quick fix to this. Can you please pull it and check? Thanks for the report and for the pull requests. You fixed some things that were in my TODO list. :)

hishamhm commented 9 years ago

Yep, working here! Thanks!