Skip to content

Commit 72a4342

Browse files
committed
fix
1 parent bc43697 commit 72a4342

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

script/vm/tracer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ function mt:lookIntoChild(action, topNode, outNode)
362362
local mainNode = topNode:copy()
363363
local blockNodes = {}
364364
for _, subBlock in ipairs(action) do
365-
self:fastWardCasts(subBlock.start, mainNode)
365+
self:resetCastsIndex(subBlock.start)
366366
local blockNode = mainNode:copy()
367367
if subBlock.filter then
368368
blockNode, mainNode = self:lookIntoChild(subBlock.filter, blockNode, mainNode)

test/type_inference/init.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,6 +4088,36 @@ elseif <?t?> then
40884088
end
40894089
]]
40904090

4091+
TEST 'A|B' [[
4092+
---@class A
4093+
---@class B
4094+
4095+
---@type A|B
4096+
local t
4097+
4098+
if x then
4099+
---@cast t A
4100+
print(t)
4101+
elseif <?t?> then
4102+
end
4103+
]]
4104+
4105+
TEST 'A|B' [[
4106+
---@class A
4107+
---@class B
4108+
4109+
---@type A|B
4110+
local t
4111+
4112+
if x then
4113+
---@cast t A
4114+
print(t)
4115+
elseif <?t?> then
4116+
---@cast t A
4117+
print(t)
4118+
end
4119+
]]
4120+
40914121
TEST 'function' [[
40924122
local function x()
40934123
print(<?x?>)

0 commit comments

Comments
 (0)