... seems to be a special name in two ways that aren't mentioned by the Overview: it's not otherwise a valid identifier, and a : varargs parameter not given that name is treated as : integer.
Code example
Type error in Nelua:
local function f(items: varargs)
print(#items) -- error: in unary operation `len`: invalid operation for type 'int64'
end
f(1, 2, 3)
Codegen error:
local function f(items: varargs) -- void va1_f_1(int64_t items)
end
f(1, 2, 3) -- error: too many arguments to function ‘va1_f_1’
Workaround
There's no problem if you write code that uses ...: varargs like in the Overview.
More ... development also seems to be waiting on the any type, based on tests like
it("any type", function()
...
expect.run_error_c([[
local function f(...) return ... end
]], "not supported yet")
Bug description
...
seems to be a special name in two ways that aren't mentioned by the Overview: it's not otherwise a valid identifier, and a: varargs
parameter not given that name is treated as: integer
.Code example
Type error in Nelua:
Codegen error:
Workaround
There's no problem if you write code that uses
...: varargs
like in the Overview.More
...
development also seems to be waiting on theany
type, based on tests likeEnvironment
x86_64 linux Nelua 0.2.0-dev Build number: 1610 Git date: 2023-11-19 16:54:45 -0300 Git hash: e82695abf0a68a30a593cefb0bf1143cf9e14b6b Semantic version: 0.2.0-dev.1610+e82695ab Copyright (C) 2019-2023 Eduardo Bart (https://nelua.io/)