andremm / typedlua

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

Loops with gmatch and multiple captures #113

Open Zash opened 7 years ago

Zash commented 7 years ago

This code:

local function foo(s : string) end

local str = "Hello World"

for a : string, b : string in string.gmatch(str,"(%w)(%w)") do
    foo(a);
    foo(b);
end

Gives this error when compiling:

test.tl:7:2: type error, attempt to pass '(nil)' to local 'foo' of input type '(string, value*)'
 foo(b);
 ^