local type MyFun = function(integer, integer): integer
local function execute(f: MyFun, x: integer, y: integer): integer
return f(x, y)
end
local function sum(x:integer, y:integer): integer
return x + y
end
execute(sum, 1, 2)
The generated Lua code replaces the MyFun local type with an empty local table declaration (note the first line):
local MyFun = {}
local function execute(f, x, y)
return f(x, y)
end
local function sum(x, y)
return x + y
end
execute(sum, 1, 2)
This variable is never used by the generated Lua code, and will make linters complain about it.
Expectation: local types should not generate Lua code at all, unless they are used by said Lua code.
Given the following example:
The generated Lua code replaces the
MyFun
local type with an empty local table declaration (note the first line):This variable is never used by the generated Lua code, and will make linters complain about it.
Expectation: local types should not generate Lua code at all, unless they are used by said Lua code.