diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 14:13:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 14:13:05 +0800 |
commit | 5c0f9c4672b564da6d54ac8649afe199e4d7b1d7 (patch) | |
tree | e3162f4c66c83fec20ab14a6060e333f29241b27 /script/core/diagnostics | |
parent | 420812ce4e77ff4143437b2893dd77fc729c7622 (diff) | |
download | lua-language-server-5c0f9c4672b564da6d54ac8649afe199e4d7b1d7.zip |
revert `field drop nil`
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/assign-type-mismatch.lua | 15 |
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 |