diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-27 20:37:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-27 20:37:20 +0800 |
commit | b19c7cefcaeac4537054be2dab6f7cf4b3d7ed26 (patch) | |
tree | 5eab7e925b74b41d7567c5341f05f78145ad2d0c /script/vm | |
parent | b6f384e930448d5259ec100117bd752802c21c7c (diff) | |
download | lua-language-server-b19c7cefcaeac4537054be2dab6f7cf4b3d7ed26.zip |
fix type-check
assign object to `nil`
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/type.lua | 3 |
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`, |