summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-18 01:03:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-18 01:03:25 +0800
commit6df9d8376bc5339a8c4218cc261dc76d7ac8e7ad (patch)
treea6e13efaf733f6b3ef618ece150aa1fb3579f456 /script/core
parent7b35e39b5eae7c3445cd9ec4d16637185bc26b93 (diff)
downloadlua-language-server-6df9d8376bc5339a8c4218cc261dc76d7ac8e7ad.zip
update
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/assign-type-mismatch.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/core/diagnostics/assign-type-mismatch.lua b/script/core/diagnostics/assign-type-mismatch.lua
index 9a101be1..d301faed 100644
--- a/script/core/diagnostics/assign-type-mismatch.lua
+++ b/script/core/diagnostics/assign-type-mismatch.lua
@@ -5,6 +5,7 @@ local vm = require 'vm'
local await = require 'await'
local checkTypes = {
+ 'setlocal',
'setglobal',
'setfield',
'setindex',
@@ -27,6 +28,12 @@ return function (uri, callback)
return
end
await.delay()
+ if source.type == 'setlocal' then
+ local locNode = vm.compileNode(source.node)
+ if not locNode:getData 'hasDefined' then
+ return
+ end
+ end
local varNode = vm.compileNode(source)
local valueNode = vm.compileNode(value)
if vm.getInfer(varNode):hasUnknown(uri) then