diff options
-rw-r--r-- | script/vm/runner.lua | 5 | ||||
-rw-r--r-- | test/type_inference/init.lua | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 8169c8f2..ec3449ee 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -140,9 +140,8 @@ function mt:_lookIntoChild(action, topNode, outNode) goto RETURN end if action.op.type == 'and' then - local dummyNode = topNode:copy() - topNode = self:_lookIntoChild(action[1], topNode, dummyNode) - topNode = self:_lookIntoChild(action[2], topNode, dummyNode) + topNode = self:_lookIntoChild(action[1], topNode, topNode:copy()) + topNode = self:_lookIntoChild(action[2], topNode, topNode:copy()) elseif action.op.type == 'or' then outNode = outNode or topNode:copy() local topNode1, outNode1 = self:_lookIntoChild(action[1], topNode, outNode) diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index cfb7d3a6..50b3901d 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -1857,6 +1857,15 @@ if xxx and x then end ]] +TEST 'integer' [[ +---@type integer? +local x + +if x and not mark[x] then + print(<?x?>) +end +]] + TEST 'integer?' [[ ---@type integer? local x |