Skip to content

Commit 63168b7

Browse files
committed
fix #1680
1 parent 0eec0d9 commit 63168b7

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
* `FIX` incorrect type check for generic with nil
55
* `FIX` [#1676]
66
* `FIX` [#1677]
7+
* `FIX` [#1680]
78

89
[#1676]: https://github.com/sumneko/lua-language-server/issues/1676
910
[#1677]: https://github.com/sumneko/lua-language-server/issues/1677
11+
[#1680]: https://github.com/sumneko/lua-language-server/issues/1680
1012

1113
## 3.6.1
1214
`2022-11-8`

script/vm/compiler.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,8 @@ local compilerSwitch = util.switch()
13671367
vm.compileByParentNode(source.parent, source.tindex, false, function (src)
13681368
if src.type == 'doc.field'
13691369
or src.type == 'doc.type.field'
1370-
or src.type == 'doc.type.name' then
1370+
or src.type == 'doc.type.name'
1371+
or guide.isLiteral(src) then
13711372
hasMarkDoc = true
13721373
vm.setNode(source, vm.compileNode(src))
13731374
end

test/diagnostics/type-check.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,11 @@ local a, b = foo(function()
11141114
end)
11151115
]]
11161116

1117+
TEST [[
1118+
---@type string|string[]|string[][]
1119+
local t = {{'a'}}
1120+
]]
1121+
11171122
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
11181123
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
11191124
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')

0 commit comments

Comments
 (0)