summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-24 17:04:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-24 17:04:12 +0800
commitbcd360a954bdf0133dbcd2605e758aeda877ef7e (patch)
tree20aa03c8186070032f7839f7f1705e465deced44
parente6c353e0cf4ea89d5fb27eac4bcae391917faa81 (diff)
downloadlua-language-server-bcd360a954bdf0133dbcd2605e758aeda877ef7e.zip
resolve #621
-rw-r--r--script/vm/function.lua4
-rw-r--r--test/diagnostics/common.lua8
2 files changed, 12 insertions, 0 deletions
diff --git a/script/vm/function.lua b/script/vm/function.lua
index 6c07acf6..9efcbd32 100644
--- a/script/vm/function.lua
+++ b/script/vm/function.lua
@@ -29,6 +29,10 @@ function vm.countParamsOfFunction(func)
local arg = func.args[i]
if arg.type == '...' then
max = math.huge
+ elseif arg.type == 'self'
+ and i == 1 then
+ min = i
+ break
elseif getDocParam(arg)
and not vm.compileNode(arg):isNullable() then
min = i
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index e6bc86ef..1f8a782d 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1695,3 +1695,11 @@ local t
local n = t:upper()
]]
+
+TEST [[
+local t = {}
+
+function t:init() end
+
+<!t.init()!>
+]]