summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/runner.lua2
-rw-r--r--test/type_inference/init.lua26
2 files changed, 27 insertions, 1 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua
index 75610ee5..7fbde208 100644
--- a/script/vm/runner.lua
+++ b/script/vm/runner.lua
@@ -177,7 +177,7 @@ function mt:_compileBlock(block)
type = 'save',
tag = 'block',
copy = true,
- pos = block.start,
+ pos = childBlock.start,
}
local outStep = {
type = 'save',
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 59ef8d1a..fb34da17 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -2191,3 +2191,29 @@ local x
print(<?x?>)
]]
+
+TEST 'string' [[
+---@type string?
+local x
+
+if not x then
+ return
+else
+ print(<?x?>)
+end
+
+print(x)
+]]
+
+TEST 'string' [[
+---@type string?
+local x
+
+if not x then
+ return
+else
+ print(x)
+end
+
+print(<?x?>)
+]]