✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: KORU108 — one arm's binding is invisible to a SIBLING arm: `t` is
// bound by `| img t`, but the `| err` arm is a disjoint path through the
// dispatch, so `t` is not on its path either.
import std/io
pub tor load { n: i64 }
| img i64
| err i64
load = if(n < 0)
| then => err n
| else => img n
pub tor show { v: i64 }
show = std/io:print.ln("v {{ v:d }}")
load(n: 3)
| img t |> show(v: t)
| err e |> show(v: t)
Actual compiler output
error[KORU108]: 't' is not in scope here — it is bound by '| img t', and an arm's bindings end with that arm
--> tests/regression/400_RUNTIME_FEATURES/400_214_sibling_arm_reference_refused/input.k:20:1
|
20 | | err e |> show(v: t)
| ^
hint: move this step into the arm body
error[KORU100]: unused binding 'e'
--> tests/regression/400_RUNTIME_FEATURES/400_214_sibling_arm_reference_refused/input.k:20:1
|
20 | | err e |> show(v: t)
| ^
hint: discard the binding using `_` if not neededMust fail at frontend compile:
Parsing or type-checking must reject the program.
Error output must contain
error[KORU108]: 't' is not in scope hereFlows
subflow ~load click a branch to expand · @labels scroll to their anchor
if (n < 0)
subflow ~show click a branch to expand · @labels scroll to their anchor
print.ln (expr: "v {{ v:d }}")
flow ~load click a branch to expand · @labels scroll to their anchor
load (n: 3)
Test Configuration
MUST_ERROR