teal-language / tl

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

Variadic fuction error about argument count #727

Closed atticus-sullivan closed 9 months ago

atticus-sullivan commented 9 months ago

I have a variadic function foo(...: string): string which performs some sort of reduce on its argument by calling foo("literal", select(2, ...)). Now tl check gives me the following error wrong number of arguments (given 2, expects 1) on this call of foo.

Currently I'm collecting the arguments in a table so I can use table.unpack in the function argument when calling foo. But of course this additional table construction is actually unneeded. Also if I do this call outside of function foo, there is no error.

Here's the playground wit that code

I hope this information are enough to reproduce and understand the problem.

hishamhm commented 9 months ago

@atticus-sullivan Thank you! It is now fixed in master!

atticus-sullivan commented 8 months ago

Works now. Thanks for fixing. And also thanks for your work/project in general :+1:.

hishamhm commented 8 months ago

Thank you for the feedback! :grin: