Skip to content

Commit 3e18b81

Browse files
committed
fix
1 parent 6f52414 commit 3e18b81

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

script/vm/runner.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function mt:_lookIntoChild(action, topNode, outNode)
117117
return topNode, topNode or outNode
118118
end
119119
self._mark[action] = true
120+
topNode = self:_fastWardCasts(action.start, topNode)
120121
if action.type == 'getlocal' then
121122
if action.node == self._loc then
122123
self._callback(action, topNode)
@@ -323,7 +324,6 @@ function mt:_lookIntoBlock(block, topNode)
323324
end
324325
for _, action in ipairs(block) do
325326
if self._has[action] then
326-
topNode = self:_fastWardCasts(action.start, topNode)
327327
topNode = self:_lookIntoChild(action, topNode)
328328
end
329329
end

test/type_inference/init.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,6 +3219,16 @@ local n
32193219
print(<?n?>)
32203220
]]
32213221

3222+
TEST 'table' [[
3223+
---@type number|table
3224+
local n
3225+
3226+
if n
3227+
---@cast n table
3228+
and <?n?>.type == 'xxx' then
3229+
end
3230+
]]
3231+
32223232
TEST 'integer' [[
32233233
---@type integer?
32243234
local n

0 commit comments

Comments
 (0)