✓
Passing Passing: the compiler rejects this program as expected.
Code
// A `__pump_<name>_retired_<i>` unit on a join that answers no `! live` can
// never fire — an immortal participant never retires — so `run` refuses it
// rather than leaving a dead arm that looks armed.
import std/io
import std/pump
import lib/flicker
lib/flicker:light(a: 1, b: 2)
std/pump:create(main)
| drained |> std/io:print.ln("all retired")
tor __pump_main_retired_0 {}
__pump_main_retired_0() |> std/io:print.ln("a retired")
std/pump(main)
! step |> lib/flicker:a-step()
std/pump(main)
! step |> lib/flicker:b-step()
! live |> lib/flicker:b-live()
std/pump:run(main)
Supporting Files
// Two countdown participants — module-level burn counters behind the
// step/live surface. `a` burns out after `a` steps, `b` after `b` — enough to
// make one join cross to live() == 0 while the pump is still driven by the
// other.
const std = @import("std");
var a_left: i64 = 0;
var b_left: i64 = 0;
~pub tor light { a: i64, b: i64 }
~proc light|zig { a_left = a; b_left = b; }
~pub tor a-step {} -> i32
~proc a-step|zig { if (a_left > 0) { a_left -= 1; return 1; } return 0; }
~pub tor a-live {} -> i64
~proc a-live|zig { return a_left; }
~pub tor b-step {} -> i32
~proc b-step|zig { if (b_left > 0) { b_left -= 1; return 1; } return 0; }
~pub tor b-live {} -> i64
~proc b-live|zig { return b_left; }
Actual compiler output
error[KORU161]: std/pump:run(main): join 0 declares `__pump_main_retired_0` but answers no `! live` - an immortal participant never retires
--> tests/regression/600_STDLIB/690_STORE/690_352_pump_retired_needs_live/input.k:23:0Must contain:
an immortal participant never retiresFlows
flow ~light click a branch to expand · @labels scroll to their anchor
light (a: 1, b: 2)
flow ~create click a branch to expand · @labels scroll to their anchor
create (expr: main)
flow ~__pump_main_retired_0 click a branch to expand · @labels scroll to their anchor
__pump_main_retired_0
flow ~std/pump click a branch to expand · @labels scroll to their anchor
std/pump (main)
flow ~std/pump click a branch to expand · @labels scroll to their anchor
std/pump (main)
flow ~run click a branch to expand · @labels scroll to their anchor
run (main)
Test Configuration
MUST_ERROR
koru.json:
{
"name": "probe",
"version": "0.1.0"
}