✓
Passing This code compiles and runs correctly.
Code
// NEGATIVE TEST (designed rejection — move semantics, DESIGN.md O2 ruling
// 2026-07-04: one lvalue path grammar, four addressing heads). `insert`
// returns the row HANDLE (`| row r`) — the primary identity; positional
// index is NOT identity (demoted to query ordering). `take` through the
// handle head extracts the row WITH ownership: it compiles as the
// `removed` lifecycle event with a synthesized obligation attached
// (`<game:item!>`-shaped — name-synthesized from the store declaration,
// the shipped qualified-phantom collections pattern, 660_027; NO generics
// exposed). A taken row that is never discharged is a RESOURCE LEAK and
// must be rejected by the phantom checker like any abandoned obligation.
//
// The disposal verb is still undesigned (give-back? destructure-consume?)
// — this pin deliberately captures only the guarantee: you CANNOT leak a
// taken row. Handle addressing `game[r]` mirrors the indexed-lvalue
// precedent (`captured { g[a][b]: v }`, 320_057).
~import std/io
~import std/store
~std/store:create(game) { hp: i64, kind: i64 }
~std/store:insert(game) { hp: 50, kind: 1 }
| row r |> std/store:take(game[r])
| item i |> std/io:print.ln("took hp {{ i.hp:d }}")
Backend must reject with:
CONTAINS obligation
CONTAINS game
CONTAINS itemError Verification
Actual Compiler Output
error[KORU030]: Resource 'i' obligation <game-item!> was not discharged. No event accepts <!game-item>.
--> auto_discharge:23:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/600_STDLIB/690_STORE/690_007_store_reject_take_leak/backend.zig:95:13: 0x1002e39d3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/600_STDLIB/690_STORE/690_007_store_reject_take_leak/backend.zig:202:28: 0x1002e4b63 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
flow ~create click a branch to expand · @labels scroll to their anchor
create (expr: game, source: hp: i64, kind: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (expr: game, source: hp: 50, kind: 1)
Test Configuration
MUST_FAIL
Expected Error:
obligation <game:item!> issued by take is never discharged — a taken row is owned and must be consumed or given back