summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-12 16:04:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-12 16:17:17 +0800
commit9902665e2a4fa9b69726df2ccce997312750c2a7 (patch)
treef24f7f3c807b06d9e4a017de6d21c0b65a346b89
parentfc46f7c495238c91e10feefca6656ac72634192c (diff)
downloadlua-language-server-9902665e2a4fa9b69726df2ccce997312750c2a7.zip
fix
-rw-r--r--script/vm/type.lua2
-rw-r--r--test/diagnostics/type-check.lua7
2 files changed, 8 insertions, 1 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 59663b6b..ed7eba16 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -153,7 +153,7 @@ function vm.isSubType(uri, child, parent, mark)
end
-- check class parent
- if childName and not mark[childName] then
+ if childName and not mark[childName] and not guide.isBasicType(childName) then
mark[childName] = true
local childClass = vm.getGlobal('type', childName)
if childClass then
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 082d0b41..243b69ff 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -694,5 +694,12 @@ mt.x = 1
mt.x = nil
]]
+TEST [[
+---@type string[]
+local t
+
+<!t!> = 'xxx'
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')