diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-26 17:01:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-26 17:01:37 +0800 |
commit | 2896a055dc7e8b8e1cf711a98b12ac633328d974 (patch) | |
tree | 53a6660c8c6fdaaf8023782351f1565c3987d44e /script/core/diagnostics | |
parent | 3020a6e5eb4d36b4d694b8248e1d4bb639bfe435 (diff) | |
download | lua-language-server-2896a055dc7e8b8e1cf711a98b12ac633328d974.zip |
fix `close-non-object`
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/close-non-object.lua | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/script/core/diagnostics/close-non-object.lua b/script/core/diagnostics/close-non-object.lua index b9d3c485..fa587823 100644 --- a/script/core/diagnostics/close-non-object.lua +++ b/script/core/diagnostics/close-non-object.lua @@ -1,6 +1,7 @@ local files = require 'files' local guide = require 'parser.guide' local lang = require 'language' +local vm = require 'vm' return function (uri, callback) local state = files.getState(uri) @@ -23,18 +24,15 @@ return function (uri, callback) } return end - if source.value.type == 'nil' - or source.value.type == 'number' - or source.value.type == 'integer' - or source.value.type == 'boolean' - or source.value.type == 'table' - or source.value.type == 'function' then + local infer = vm.getInfer(source.value) + if not infer:hasClass() + and not infer:hasType 'nil' + and infer:view('any', uri) ~= 'any' then callback { start = source.value.start, finish = source.value.finish, message = lang.script.DIAG_COSE_NON_OBJECT, } - return end end) end |