diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-16 21:13:07 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-16 21:13:07 +0800 |
commit | b1d96627a1af5e4485720636dfb1d4f767e184d5 (patch) | |
tree | 09667e0d55139d8093f3dde565919619def885e7 /script | |
parent | 1aa0cf49b70dc2489d116e412ecf632c95178f24 (diff) | |
download | lua-language-server-b1d96627a1af5e4485720636dfb1d4f767e184d5.zip |
don't check `unknown`
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/cast-local-type.lua | 4 | ||||
-rw-r--r-- | script/vm/infer.lua | 7 | ||||
-rw-r--r-- | script/vm/type.lua | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/script/core/diagnostics/cast-local-type.lua b/script/core/diagnostics/cast-local-type.lua index 1284e934..f466f923 100644 --- a/script/core/diagnostics/cast-local-type.lua +++ b/script/core/diagnostics/cast-local-type.lua @@ -16,10 +16,14 @@ return function (uri, callback) if not loc.ref then return end + await.delay() local locNode = vm.compileNode(loc) if not locNode:getData 'hasDefined' then return end + if vm.getInfer(loc):hasUnknown(uri) then + return + end for _, ref in ipairs(loc.ref) do if ref.type == 'setlocal' then await.delay() diff --git a/script/vm/infer.lua b/script/vm/infer.lua index 422990f8..e0ab90bb 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -261,6 +261,13 @@ function mt:hasType(uri, tp) end ---@param uri uri +function mt:hasUnknown(uri) + self:_computeViews(uri) + return not next(self.views) + or self.views['unknown'] == true +end + +---@param uri uri ---@return boolean function mt:hasClass(uri) self:_computeViews(uri) diff --git a/script/vm/type.lua b/script/vm/type.lua index 3eb42e51..e2f723bc 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -39,7 +39,7 @@ function vm.isSubNode(child, parent, mark) mark = mark or {} local childName = getNodeName(child) local parentName = getNodeName(parent) - if childName == 'any' + if childName == 'any' or parentName == 'any' then return true end |