summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 14:13:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 14:13:05 +0800
commit5c0f9c4672b564da6d54ac8649afe199e4d7b1d7 (patch)
treee3162f4c66c83fec20ab14a6060e333f29241b27 /script/core/diagnostics
parent420812ce4e77ff4143437b2893dd77fc729c7622 (diff)
downloadlua-language-server-5c0f9c4672b564da6d54ac8649afe199e4d7b1d7.zip
revert `field drop nil`
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/assign-type-mismatch.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/script/core/diagnostics/assign-type-mismatch.lua b/script/core/diagnostics/assign-type-mismatch.lua
index b7d11226..ae4b3512 100644
--- a/script/core/diagnostics/assign-type-mismatch.lua
+++ b/script/core/diagnostics/assign-type-mismatch.lua
@@ -38,13 +38,14 @@ return function (uri, callback)
end
end
local valueNode = vm.compileNode(value)
- if source.type == 'setindex'
- or source.type == 'setfield'
- or source.type == 'tablefield'
- or source.type == 'tableindex' then
- if valueNode:hasName 'nil' then
- valueNode = valueNode:copy():removeOptional()
- if valueNode:isEmpty() then
+ 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'
+ or n.type == 'doc.type.table'
+ or n.type == 'table' then
return
end
end