✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test: `koruc explain` answers for a program the compiler REFUSES —
// explain runs on the pre-transform tree, so an orphan join (no
// `std/pump:create`) and a `! wait` without `! live` still report with
// the same refusal reasons the transform raises. post.sh asserts the
// report; MUST_ERROR pins that the compiler still refuses the program.
import std/io
import std/pump
import std/explain
// orphan join — no pump named 'ghost' is ever created
std/pump(ghost)
! step |> step()
std/pump:create(main)
// `! wait` without `! live` — interests are indexed 0..live()
std/pump(main)
! step |> step()
! wait i |> wait(i)
std/pump:run(main)
Actual compiler output
error[KORU161]: std/pump(ghost): no pump named 'ghost' - `std/pump:create(ghost)` declares it, and the declaration precedes its joins
--> tests/regression/600_STDLIB/690_STORE/690_318_explain_reports_pump_refusals/input.k:11:0
error[KORU161]: std/pump(main): `! wait` needs `! live` beside it - interests are indexed `0..live()`, and without a live count the pump cannot enumerate them (an immortal participant's single interest is a later slice)
--> tests/regression/600_STDLIB/690_STORE/690_318_explain_reports_pump_refusals/input.k:17:0Must contain:
KORU161Test Configuration
MUST_ERROR
Post-validation Script:
#!/bin/bash
# The program refuses (orphan join + wait-without-live), but `koruc explain`
# still runs on the pre-transform tree and reports WHY — the same refusal
# reasons the transforms raise, as report rows.
set -e
echo "=== koruc explain on a refusing program ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/pump" || { echo "FAIL: pump report missing"; exit 1; }
echo "$TEXT" | grep -q "no pump named 'ghost'" || { echo "FAIL: orphan join not reported"; exit 1; }
echo "$TEXT" | grep -q "needs \`! live\` beside it" || { echo "FAIL: wait/live refusal not reported"; exit 1; }
echo "$TEXT" | grep -q "j0.status = refused" || { echo "FAIL: refused status not typed"; exit 1; }
echo "=== PASS: explain reports pump refusals ==="