diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-22 19:12:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-22 19:12:45 +0800 |
commit | 9091e064ab23b6b158551a4d256b65b033cb1688 (patch) | |
tree | cccfe054421dee937fb46390c70ba48869e5d7a1 /script/vm | |
parent | 79f76ed6611701ca5994fe110eb09e9309499918 (diff) | |
download | lua-language-server-9091e064ab23b6b158551a4d256b65b033cb1688.zip |
stash
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/type.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua index 208f21ed..1cbda65d 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -87,7 +87,9 @@ function vm.isSubType(uri, child, parent, mark) local childName = getNodeName(child) local parentName = getNodeName(parent) if childName == 'any' - or parentName == 'any' then + or parentName == 'any' + or childName == 'unknown' + or parentName == 'unknown' then return true end @@ -240,12 +242,13 @@ function vm.canCastType(uri, defNode, refNode) local defInfer = vm.getInfer(defNode) local refInfer = vm.getInfer(refNode) - if defInfer:hasUnknown(uri) - or defInfer:hasAny(uri) then + if defInfer:hasAny(uri) then return true end - if refInfer:hasUnknown(uri) - or refInfer:hasAny(uri) then + if refInfer:hasAny(uri) then + return true + end + if defInfer:view(uri) == 'unknown' then return true end |