✓
Passing Passing: the compiler rejects this program as expected.
Code
// OWED refusal: a `! src` arm receiving an obligated value must discharge
// it — `v: Src<live!>` minted at delivery cannot silently drop. Reading the
// payload is fine; abandoning custody is not. The obligation system reaches
// across the ring to the receive side — that is the entire point.
import std/io
import std/proto
import std/channel
import std/pump
std/proto(Src) {
id: i64
}
pub tor mk { i: i64 } -> Src<live!>
mk -> { id: i }
pub tor dispose { s: Src<!live> } -> i64
dispose -> s.id
std/channel:new(inbox, capacity: 8) { src: Src }
std/channel(inbox)
! src v |> std/io:print.ln("leaked {{ v.id:d }}")
mk(i: 1): s |> std/channel:send(inbox, s)
| ok |> std/io:print.ln("sent")
| full |> std/io:print.ln("full")
| closed |> std/io:print.ln("closed")
std/pump:create(main)
| drained |> std/io:print.ln("drained")
std/pump(main)
! step |> inbox-step()
! live |> inbox-live()
std/pump:run(main)
Actual compiler output
error[KORU030]: Resource 'v' obligation <live!> was not discharged. Call one of: send, dispose
--> tests/regression/600_STDLIB/699_CHANNEL/699_027_arm_must_discharge/input.k:20:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must fail at runtime:
Program must error when executed.
Error output must contain
not dischargedFlows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Src, source: id: i64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: inbox, capacity: 8, source: src: Src)
flow ~std/channel click a branch to expand · @labels scroll to their anchor
std/channel (inbox)
flow ~mk click a branch to expand · @labels scroll to their anchor
mk (i: 1)
flow ~create click a branch to expand · @labels scroll to their anchor
create (expr: 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