summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-20 22:41:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-20 22:41:29 +0800
commit28d5a33077b28dcbb52974aaf90125cee013342b (patch)
tree59fd46d990a0f0ca5c5c05808dde882280717540 /script/core
parent58df10c5d5957b8437e76e271f7c7c1a41aca105 (diff)
downloadlua-language-server-28d5a33077b28dcbb52974aaf90125cee013342b.zip
update `array[1] = nil`
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/assign-type-mismatch.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/script/core/diagnostics/assign-type-mismatch.lua b/script/core/diagnostics/assign-type-mismatch.lua
index 37e18d09..30d0f97c 100644
--- a/script/core/diagnostics/assign-type-mismatch.lua
+++ b/script/core/diagnostics/assign-type-mismatch.lua
@@ -37,8 +37,18 @@ return function (uri, callback)
return
end
end
- local varNode = vm.compileNode(source)
local valueNode = vm.compileNode(value)
+ if source.type == 'setindex'
+ and vm.isSubType(uri, valueNode, 'nil') then
+ -- boolean[1] = nil
+ local tnode = vm.compileNode(source.node)
+ for n in tnode:eachObject() do
+ if n.type == 'doc.type.array' then
+ return
+ end
+ end
+ end
+ local varNode = vm.compileNode(source)
if vm.canCastType(uri, varNode, valueNode) then
return
end