Skip to content

Commit b1e0cdb

Browse files
committed
fix again
1 parent b175fd2 commit b1e0cdb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

script/core/diagnostics/assign-type-mismatch.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ return function (uri, callback)
7676
return
7777
end
7878
if source.type == 'setfield'
79-
or source.type == 'setindex'
80-
or source.type == 'tableexp' then
79+
or source.type == 'setindex' then
8180
return
8281
end
8382
end
8483

8584
local valueNode = vm.compileNode(value)
86-
if source.type == 'setindex' then
85+
if source.type == 'setindex'
86+
or source.type == 'tableexp' then
8787
-- boolean[1] = nil
8888
valueNode = valueNode:copy():removeOptional()
8989
end

test/diagnostics/type-check.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,14 @@ TEST [[
961961
local t = { true, false, nil }
962962
]]
963963

964+
TEST [[
965+
---@type boolean|nil
966+
local x
967+
968+
---@type boolean[]
969+
local t = { true, false, x }
970+
]]
971+
964972
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
965973
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
966974
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')

0 commit comments

Comments
 (0)