summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/diagnostics/assign-type-mismatch.lua16
-rw-r--r--script/vm/compiler.lua4
2 files changed, 12 insertions, 8 deletions
diff --git a/script/core/diagnostics/assign-type-mismatch.lua b/script/core/diagnostics/assign-type-mismatch.lua
index 6809760c..0cccc7ee 100644
--- a/script/core/diagnostics/assign-type-mismatch.lua
+++ b/script/core/diagnostics/assign-type-mismatch.lua
@@ -64,16 +64,20 @@ return function (uri, callback)
return
end
end
- --[[
- ---@class A
- local mt
- ---@type X
- mt._x = nil -- don't warn this
- ]]
if value.type == 'nil' then
+ --[[
+ ---@class A
+ local mt
+ ---@type X
+ mt._x = nil -- don't warn this
+ ]]
if hasMarkType(source) then
return
end
+ if source.type == 'setfield'
+ or source.type == 'setindex' then
+ return
+ end
end
local valueNode = vm.compileNode(value)
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 67ca3b41..12cf102b 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1387,7 +1387,7 @@ local compilerSwitch = util.switch()
if src.value then
if bindDocs(src) then
vm.setNode(source, vm.compileNode(src))
- else
+ elseif src.value.type ~= 'nil' then
vm.setNode(source, vm.compileNode(src.value))
local node = vm.getNode(src)
if node then
@@ -1949,7 +1949,7 @@ local function compileByGlobal(source)
vm.setNode(set, globalNode, true)
end
for _, set in ipairs(global:getSets(uri)) do
- if set.value then
+ if set.value and set.value.type ~= 'nil' then
if not hasMarkDoc or guide.isLiteral(set.value) then
globalNode:merge(vm.compileNode(set.value))
end