✓
Passing This code compiles and runs correctly.
Code
// PIN (collapse-recursion pass, WAY-TWO leg — CONTROL): a recursive tor
// whose else-chain interleaves a foreign call (std/io:print.ln) is not a
// pure accumulator — the structural matchers refuse, so no
// __koru_collapse_ marker may appear. Output stays 3.
import std/io
pub tor bad { n: i64, acc: i64 } -> i64
bad = if(n == 0)
| then -> acc
| else |> bad(n: n - 1, acc: acc + 1): h |> std/io:print.ln("x"): _ |> bad(n: n - 1, acc: h + 1): v -> v
bad(n: 1, acc: 0): r |> std/io:print.ln("{{ r:d }}")
Actual
x
2
Expected output
x
2
Flows
subflow ~bad click a branch to expand · @labels scroll to their anchor
if (n == 0)
flow ~bad click a branch to expand · @labels scroll to their anchor
bad (n: 1, acc: 0)
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# Pin (CONTROL): recursion interleaved with a foreign call must NOT be
# collapsed — the chain's middle link is not a self-call, so the matchers
# refuse and no __koru_collapse_ marker may appear.
set -e
if grep -q '__koru_collapse_' output_emitted.zig; then
echo "FAIL: __koru_collapse_ marker present — IO-interleaved recursion was collapsed"
exit 1
fi