summaryrefslogtreecommitdiff
path: root/script/vm/type.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-18 23:07:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-18 23:07:41 +0800
commita92a8003600dc2a0dc867c31bd817320cf6f7c56 (patch)
treedce16f39f9fabb3c7aa59a20c975098a09eede82 /script/vm/type.lua
parent38ad313a97e4c191dfefe5831ffb373242f36fa2 (diff)
downloadlua-language-server-a92a8003600dc2a0dc867c31bd817320cf6f7c56.zip
fix #1346
Diffstat (limited to 'script/vm/type.lua')
-rw-r--r--script/vm/type.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 5d42de6c..6f2d6f35 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -105,13 +105,16 @@ function vm.isSubType(uri, child, parent, mark)
child = global
elseif child.type == 'vm.node' then
if config.get(uri, 'Lua.type.weakUnionCheck') then
+ local hasKnownType
for n in child:eachObject() do
- if getNodeName(n)
- and vm.isSubType(uri, n, parent, mark) then
- return true
+ if getNodeName(n) then
+ hasKnownType = true
+ if vm.isSubType(uri, n, parent, mark) then
+ return true
+ end
end
end
- return false
+ return not hasKnownType
else
local weakNil = config.get(uri, 'Lua.type.weakNilCheck')
for n in child:eachObject() do