✓
Passing This code compiles and runs correctly.
Code
// A record-field obligation issued and discharged INSIDE a `std/store:query`
// arm. The arm is a transplanted sweep body (`__store_sweepbody_`, 690_252);
// `make` returns `{ h: *Handle<owned!>, n: i64 }` (330_096's field shape) and
// the arm pays `r.h` off per row with `lib/res:dispose(r.h)` — issue-local,
// discharge-local, inside an iterated body. Locks the composition: the sweep
// transplant keeps per-field obligation tracking both ways (the drop sibling
// raises KORU030; this discharge credits).
import std/io
import std/store
import app/lib/res
std/store:new(items, capacity: 4) { v: i64 }
std/store:insert(items) { v: 7 }
| row _ |> _
std/store:insert(items) { v: 8 }
| row _ |> _
std/store:query(items)
! query e |> app/lib/res:make(id: e.v): r |> app/lib/res:dispose(r.h) |> std/io:print.ln("n={{ r.n:d }}")
Supporting Files
// Owned-ptr resource issued as a RECORD FIELD (`{ h: *Handle<owned!>, n }`) —
// the field-obligation shape 330_096 pins, produced inside a query arm.
const std = @import("std");
const Handle = struct { n: i32 };
~pub tor make { id: i64 } -> { h: *Handle<owned!>, n: i64 }
~proc make|zig {
const h = std.heap.page_allocator.create(Handle) catch unreachable;
h.* = .{ .n = @intCast(id) };
return .{ .h = h, .n = id * 10 };
}
~pub tor dispose { h: *Handle<!owned> }
~proc dispose|zig {
std.debug.print("disposed {}\n", .{h.n});
std.heap.page_allocator.destroy(h);
}
Actual
disposed 7
n=70
disposed 8
n=80
Expected output
disposed 7
n=70
disposed 8
n=80
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (items, capacity: 4, source: v: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (items, source: v: 7)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (items, source: v: 8)
flow ~query click a branch to expand · @labels scroll to their anchor
query (items)
Test Configuration
MUST_RUN