Skip to content

Commit 50688a8

Browse files
committed
fix #1150
1 parent dfab76e commit 50688a8

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* `FIX` [#1134](https://github.com/sumneko/lua-language-server/issues/1134)
1212
* `FIX` [#1141](https://github.com/sumneko/lua-language-server/issues/1141)
1313
* `FIX` [#1144](https://github.com/sumneko/lua-language-server/issues/1144)
14+
* `FIX` [#1150](https://github.com/sumneko/lua-language-server/issues/1150)
1415

1516
## 3.2.3
1617
`2022-5-16`

script/config/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ function m.update(scp, ...)
434434

435435
local news = table.pack(...)
436436
for i = 1, news.n do
437-
if news[i] then
437+
if type(news[i]) == 'table' then
438438
expand(news[i])
439439
end
440440
end

script/vm/compiler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ end
533533
-- 该函数有副作用,会给source绑定node!
534534
local function bindDocs(source)
535535
local isParam = source.parent.type == 'funcargs'
536-
or source.parent.type == 'in'
536+
or (source.parent.type == 'in' and source.finish <= source.parent.keys.finish)
537537
local docs = source.bindDocs
538538
for i = #docs, 1, -1 do
539539
local doc = docs[i]

test/type_inference/init.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,3 +2323,29 @@ end
23232323
23242324
local <?z?> = f()
23252325
]]
2326+
2327+
TEST 'number' [[
2328+
for _ in _ do
2329+
---@type number
2330+
local <?x?>
2331+
end
2332+
]]
2333+
2334+
TEST 'unknown' [[
2335+
for _ in _ do
2336+
---@param x number
2337+
local <?x?>
2338+
end
2339+
]]
2340+
2341+
TEST 'unknown' [[
2342+
---@type number
2343+
for <?x?> in _ do
2344+
end
2345+
]]
2346+
2347+
TEST 'number' [[
2348+
---@param x number
2349+
for <?x?> in _ do
2350+
end
2351+
]]

0 commit comments

Comments
 (0)