diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/diagnostics.lua | 3 | ||||
-rw-r--r-- | server/src/vm/emmy.lua | 3 | ||||
-rw-r--r-- | server/src/vm/function.lua | 1 | ||||
-rw-r--r-- | server/test/diagnostics/init.lua | 6 |
4 files changed, 12 insertions, 1 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index badf3b00..8eab5960 100644 --- a/server/src/core/diagnostics.lua +++ b/server/src/core/diagnostics.lua @@ -14,6 +14,9 @@ function mt:searchUnusedLocals(callback) if not loc then return end + if loc:get 'emmy arg' then + return + end local name = loc:getName() if name == '_' or name == '_ENV' or name == '' then return diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua index 45fb13f9..b193a7de 100644 --- a/server/src/vm/emmy.lua +++ b/server/src/vm/emmy.lua @@ -312,7 +312,8 @@ function mt:buildEmmyFunctionType(source) local value = self:createValue(paramType:getType(), typeSource) value:setEmmy(paramType) self:instantSource(nameSource) - func:addArg(nameSource[1], nameSource, value) + local arg = func:addArg(nameSource[1], nameSource, value) + arg:set('emmy arg', true) end end local returns = source.returns diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index b6772cd1..1ba01363 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -391,6 +391,7 @@ function mt:addArg(name, source, value, close) loc:close(close) self:saveUpvalue(name, loc) self.args[#self.args+1] = loc + return loc end function mt:createArg(vm, arg, close) diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index 5d015dfd..094e7549 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -444,6 +444,12 @@ TEST [[ ]] TEST [[ +---@type fun(a: integer) +local f +f() +]] + +TEST [[ local x <const> = 1 <!x!> = 2 return x |