✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test: `koruc explain` on a program that REFUSES — explain runs instead
// of the pipeline, so the explainer folds the same meet on a broken
// program and reports each refusal with its reason: an orphaned anchor,
// a bound on a non-integer terminal. The compile still refuses KORU205.
import std/proto
import std/refine
import std/explain
std/proto:string(Email)
std/refine(Ghost) {
port: i64 & >1024
}
std/proto(Contact) {
email: Email
}
std/refine(Contact) {
email: Email & >5
}
Actual compiler output
error[KORU205]: std/refine(Ghost): no declaration named 'Ghost' in home 'input' to refine — refine meets a `std/proto` declaration
--> tests/regression/600_STDLIB/671_REFINE/671_019_explain_reports_refusals/input.k:11:0
error[KORU205]: std/refine(Contact): field 'email' constrains base 'Email' — bounds and clamps refine integer scalars only
--> tests/regression/600_STDLIB/671_REFINE/671_019_explain_reports_refusals/input.k:19:0Must contain:
KORU205Flows
flow ~string click a branch to expand · @labels scroll to their anchor
string (expr: Email)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Ghost, source: port: i64 & >1024)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Contact, source: email: Email)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Contact, source: email: Email & >5)
Test Configuration
MUST_ERROR
Post-validation Script:
#!/bin/bash
# The program refuses to compile (MUST_ERROR pins the KORU205) — but
# `koruc explain` runs INSTEAD of the pipeline, so it reports the same
# refusals as data: the orphaned anchor and the non-integer terminal bound.
set -e
echo "=== koruc explain on a refusing program ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/refine" || { echo "FAIL: refine report missing"; exit 1; }
echo "$TEXT" | grep -q "input:Ghost" || { echo "FAIL: orphan section missing"; exit 1; }
echo "$TEXT" | grep -q "refused: no std/proto declaration" || { echo "FAIL: orphan status missing"; exit 1; }
echo "$TEXT" | grep -q "refused: no declaration named 'Ghost'" || { echo "FAIL: orphan field status missing";exit 1; }
echo "$TEXT" | grep -q "resolves to 'string'" || { echo "FAIL: terminal resolution missing";exit 1; }
echo "$TEXT" | grep -q "bounds and clamps refine integer scalars only" || { echo "FAIL: non-int refusal missing"; exit 1; }
echo "=== PASS: explain reports refusals on a program that cannot compile ==="