✗
Failing This test is currently failing.
Failed: wrong-error
Failure Output
error[KORU030]: Resource '_auto_7' obligation <open!> was not discharged. Call one of: cancel, __store_insert_batch, __store_inserth_batch
--> tests/regression/600_STDLIB/690_STORE/690_108_drain_discard_names_no_synthetic_binding/input.k:6:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
(set KORU_BACKEND_TRACE=1 for the backend return trace) Code
import std/io
import std/store
import app/lib/pend
std/store:new(batch, capacity: 2) { *app/lib/pend:Pending<open!> }
! discharge _ |> app/lib/pend:cancel(): n |> std/io:print.ln("cancelled {{ n:d }}")
app/lib/pend:start(): p |> std/store:insert(batch) { p }
| row _ |> _
std/io:print.ln("inserted")
Must contain:
dischargeFlows
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: batch, capacity: 2, source: *app/lib/pend:Pending<open!>)
flow ~start click a branch to expand · @labels scroll to their anchor
start
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "inserted")
Imported Files
// An owned resource with ZERO dischargers a store can fire: *Pending<open!> is
// consumed only by `cancel`, and `cancel` hands back a value. A store tears its
// elements down unattended, where there is nobody to take a return — so the
// column cannot be auto-discharged at any count, and must be DRAINED by a
// `! discharge` arm bolted onto the declaration.
//
// This is the shape koru/curl:Pending has in koru-examples/downloads, where
// `~pub tor cancel { p: *Pending<!open> } -> *Multi<owned!>` returns the batch.
// An i64 return carries the same property without a second obligation.
//
// The contrast is app/lib/tx (690_057/058/097): TWO void dischargers, so the
// store could fire either and refuses because it cannot pick. Here there is
// nothing to pick from.
const std = @import("std");
const Pending = struct { id: i32 };
~pub tor start { } -> *Pending<open!>
~proc start|zig {
const p = std.heap.page_allocator.create(Pending) catch unreachable;
p.* = .{ .id = 3 };
return p;
}
~pub tor cancel { p: *Pending<!open> } -> i64
~proc cancel|zig {
const id = p.id;
std.heap.page_allocator.destroy(p);
return id;
}