summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-27 20:37:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-27 20:37:20 +0800
commitb19c7cefcaeac4537054be2dab6f7cf4b3d7ed26 (patch)
tree5eab7e925b74b41d7567c5341f05f78145ad2d0c /script/vm
parentb6f384e930448d5259ec100117bd752802c21c7c (diff)
downloadlua-language-server-b19c7cefcaeac4537054be2dab6f7cf4b3d7ed26.zip
fix type-check
assign object to `nil`
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/type.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 15504878..f2870d28 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -433,6 +433,9 @@ function vm.canCastType(uri, defNode, refNode)
if refInfer:view(uri) == 'unknown' then
return true
end
+ if defInfer:view(uri) == 'nil' then
+ return true
+ end
if vm.isSubType(uri, refNode, 'nil') then
-- allow `local x = {};x = nil`,