✓
Passing This code compiles and runs correctly.
Code
// PIN: after `std/string:take(s)` consumes the <view!> binding `s` and
// produces a new <instance!> binding `owned`, the old binding `s` is stale.
// Using `s` in a subsequent call is use-after-discharge: the view! obligation
// was consumed by take, and `s` no longer has a valid phantom state.
//
// The transition take: *String<!view> → | instance *String<instance!>
// is the ATS/Mezzo "transfer" move: ownership moves to a new name.
// The old name is invalid from that point forward.
//
// Grounding:
// - take consuming <!view>: koru_std/string.kz:74
// - take producing instance!: koru_std/string.kz:75
// - from-page/take flow shape: 610_002_string_ownership/input.kz:5-11
// - use-after-discharge shape: 610_005_reject_use_after_free/input.kz:6 (free then read)
~import std/string
~std/string:from-page(text: "hello")
| ok s |> std/string:take(s)
| instance owned |> std/string:read(s)
| slice _ |> std/string:free(s: owned)
| err _ |> _
Must contain:
Use-after-dischargeError Verification
Actual Compiler Output
error[KORU030]: Use-after-discharge: binding 's' was already discharged and cannot be used
--> phantom_semantic_check:18:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/335_OBLIGATION_STRESS/335_024_stale_view_after_take/backend.zig:94:13: 0x104ba63b3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/335_OBLIGATION_STRESS/335_024_stale_view_after_take/backend.zig:190:28: 0x104ba709f in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL