Skip to content

Commit 7de3d68

Browse files
committed
fix infer in table
1 parent 75b8b11 commit 7de3d68

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

script/vm/runner.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ function mt:_lookInto(action, topNode, outNode)
304304
end
305305
elseif action.type == 'getindex' then
306306
self:_lookInto(action.index, topNode)
307+
elseif action.type == 'table' then
308+
for _, field in ipairs(action) do
309+
self:_lookInto(field, topNode)
310+
end
307311
end
308312
::RETURN::
309313
topNode = self:_fastWard(action.finish, topNode)

test/type_inference/init.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,3 +3175,12 @@ print(<?f?>)
31753175
31763176
function f() end
31773177
]]
3178+
3179+
TEST 'number' [[
3180+
---@type number|nil
3181+
local n
3182+
3183+
local t = {
3184+
x = n and <?n?>,
3185+
}
3186+
]]

0 commit comments

Comments
 (0)