Skip to content

Commit 943ba62

Browse files
committed
fix or
1 parent 1d7773f commit 943ba62

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

script/vm/runner.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,14 @@ function mt:_compileNarrowByFilter(filter, outStep, blockStep)
8282
self:_compileNarrowByFilter(filter[2], dummyStep, blockStep)
8383
end
8484
if filter.op.type == 'or' then
85+
self:_compileNarrowByFilter(filter[1], outStep, blockStep)
8586
local dummyStep = {
86-
type = 'save',
87-
tag = 'dummy out',
87+
type = 'push',
8888
copy = true,
8989
ref1 = outStep,
90-
pos = filter.start - 1,
91-
}
92-
self.steps[#self.steps+1] = dummyStep
93-
self:_compileNarrowByFilter(filter[1], dummyStep, blockStep)
94-
self.steps[#self.steps+1] = {
95-
type = 'push',
96-
ref1 = dummyStep,
9790
pos = filter.op.finish,
9891
}
92+
self.steps[#self.steps+1] = dummyStep
9993
self:_compileNarrowByFilter(filter[2], outStep, dummyStep)
10094
self.steps[#self.steps+1] = {
10195
type = 'push',

test/type_inference/init.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,11 +2060,22 @@ if x.y or not x then
20602060
end
20612061
]]
20622062

2063-
TEST 'integer?' [[
2063+
TEST 'integer' [[
20642064
---@type integer?
20652065
local x
20662066
2067-
if not x or x.y then
2067+
if not x or not y then
2068+
return
2069+
end
2070+
2071+
print(<?x?>)
2072+
]]
2073+
2074+
TEST 'integer' [[
2075+
---@type integer?
2076+
local x
2077+
2078+
if not y or not x then
20682079
return
20692080
end
20702081

0 commit comments

Comments
 (0)