✗
Failing This test is currently failing.
Failed: wrong-error
Failure Output
error[KORU160]: store 'batch': column *app/lib/pend:Pending cannot be auto-discharged — every exit from <open!> in app/lib/pend returns a value or carries branches
--> tests/regression/600_STDLIB/690_STORE/690_104_undrainable_column_reports_once/input.k:5:0
hint: a store disposes elements unattended at teardown, where there is nobody to take a return value or answer a branch — so drain it by hand: bolt `! discharge item |> app/lib/pend:<exit>(item.<field>)` onto the declaration. The arm is ordinary Koru, so pipe whatever sequence the type needs and its own obligations settle normally
error[KORU161]: std/store:new(batch): column *app/lib/pend:Pending has 0 dischargers for <!open> (ambiguous) - the store cannot pick one, so it must be DRAINED: bolt a `! discharge item |> ...` handler onto the store declaration to discharge each still-live element at teardown
--> tests/regression/600_STDLIB/690_STORE/690_104_undrainable_column_reports_once/input.k:5:0 Code
import std/store
import app/lib/pend
std/store:new(batch, capacity: 2) { *app/lib/pend:Pending<open!> }
app/lib/pend:start(): p |> std/store:insert(batch) { p }
| row _ |> _
Must contain:
cannot be auto-dischargedFlows
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
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;
}