summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/vm/compiler.lua3
-rw-r--r--test/diagnostics/type-check.lua5
3 files changed, 9 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index d3908446..b33ece88 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,9 +4,11 @@
* `FIX` incorrect type check for generic with nil
* `FIX` [#1676]
* `FIX` [#1677]
+* `FIX` [#1680]
[#1676]: https://github.com/sumneko/lua-language-server/issues/1676
[#1677]: https://github.com/sumneko/lua-language-server/issues/1677
+[#1680]: https://github.com/sumneko/lua-language-server/issues/1680
## 3.6.1
`2022-11-8`
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 0cc27d81..06f09ebb 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1367,7 +1367,8 @@ local compilerSwitch = util.switch()
vm.compileByParentNode(source.parent, source.tindex, false, function (src)
if src.type == 'doc.field'
or src.type == 'doc.type.field'
- or src.type == 'doc.type.name' then
+ or src.type == 'doc.type.name'
+ or guide.isLiteral(src) then
hasMarkDoc = true
vm.setNode(source, vm.compileNode(src))
end
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index ff2eddea..d04a2f5e 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -1114,6 +1114,11 @@ local a, b = foo(function()
end)
]]
+TEST [[
+---@type string|string[]|string[][]
+local t = {{'a'}}
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')