✓
Passing Passing: the compiler rejects this program as expected.
Code
// A delegated policy must take `t: i64` — the retry counter is the bound
// the compiler cannot see inside the tor. Arm mode reads the escape in
// the `when`; delegation's only visible bound channel is `t` itself.
// A policy without it is refused, keep-alive contract intact.
import std/supervisor
pub tor dial { port: i64 }
| ok i64
| refused i64
proc dial|zig {
return .{ .refused = port };
}
pub tor blind { f: i64 }
| retry i64
| exhausted
proc blind|zig {
return .{ .retry = f + 1 };
}
pub tor connect { port: i64 }
| ok i64
| refused i64
connect = dial(port)
| ok p => ok p
| refused f |> std/supervisor:supervised { policy: blind }
connect(port: 8080)
Actual compiler output
error[KORU161]: std/supervisor:supervised: policy 'blind' must take 't: i64' — the retry counter is the bound the compiler cannot see inside the tor; keep-alive conditions carry their own escape
--> tests/regression/320_CONTROL_FLOW/320_164_supervised_policy_requires_counter/input.k:29:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
subflow ~connect click a branch to expand · @labels scroll to their anchor
dial (port)
flow ~connect click a branch to expand · @labels scroll to their anchor
connect (port: 8080)
Test Configuration
MUST_ERROR