diff options
-rw-r--r-- | script/vm/runner.lua | 12 | ||||
-rw-r--r-- | test/type_inference/init.lua | 15 |
2 files changed, 16 insertions, 11 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua index dedc48be..ad2b18ea 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -82,20 +82,14 @@ function mt:_compileNarrowByFilter(filter, outStep, blockStep) self:_compileNarrowByFilter(filter[2], dummyStep, blockStep) end if filter.op.type == 'or' then + self:_compileNarrowByFilter(filter[1], outStep, blockStep) local dummyStep = { - type = 'save', - tag = 'dummy out', + type = 'push', copy = true, ref1 = outStep, - pos = filter.start - 1, - } - self.steps[#self.steps+1] = dummyStep - self:_compileNarrowByFilter(filter[1], dummyStep, blockStep) - self.steps[#self.steps+1] = { - type = 'push', - ref1 = dummyStep, pos = filter.op.finish, } + self.steps[#self.steps+1] = dummyStep self:_compileNarrowByFilter(filter[2], outStep, dummyStep) self.steps[#self.steps+1] = { type = 'push', diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index a6f18f65..21e140af 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -2060,11 +2060,22 @@ if x.y or not x then end ]] -TEST 'integer?' [[ +TEST 'integer' [[ ---@type integer? local x -if not x or x.y then +if not x or not y then + return +end + +print(<?x?>) +]] + +TEST 'integer' [[ +---@type integer? +local x + +if not y or not x then return end |