summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/vm/sign.lua4
-rw-r--r--script/vm/type.lua3
-rw-r--r--test/type_inference/init.lua18
4 files changed, 26 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index bdd6c804..fc758c24 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,7 @@
# changelog
## 3.5.1
+* `FIX` [#1335](https://github.com/sumneko/lua-language-server/issues/1335)
* `FIX` [#1354](https://github.com/sumneko/lua-language-server/issues/1354)
## 3.5.0
diff --git a/script/vm/sign.lua b/script/vm/sign.lua
index a0478751..7c95fd08 100644
--- a/script/vm/sign.lua
+++ b/script/vm/sign.lua
@@ -63,6 +63,10 @@ function mt:resolve(uri, args, removeGeneric)
resolve(object.node, vm.compileNode(field.extends))
end)
end
+ if n.type == 'table' and #n >= 1 then
+ -- { x } / { ... } -> T[]
+ resolve(object.node, vm.compileNode(n[1]))
+ end
end
end
if object.type == 'doc.type.table' then
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 6f2d6f35..d112be2c 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -310,6 +310,9 @@ function vm.getTableValue(uri, tnode, knode, inversion)
end
end
end
+ if field.type == 'varargs' then
+ result:merge(vm.compileNode(field))
+ end
end
end
end
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 43fb3c62..162841ac 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -3737,3 +3737,21 @@ function m:init()
return <?self?>
end
]]
+
+TEST 'string' [[
+---@vararg string
+function F(...)
+ local t = {...}
+ for k, <?v?> in pairs(t) do
+ end
+end
+]]
+
+TEST 'string' [[
+---@vararg string
+function F(...)
+ local t = {...}
+ for k, <?v?> in ipairs(t) do
+ end
+end
+]]