From a92a8003600dc2a0dc867c31bd817320cf6f7c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 18 Jul 2022 23:07:41 +0800 Subject: fix #1346 --- script/vm/type.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'script/vm/type.lua') 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 -- cgit v1.2.3