✓
Passing Passing: the compiler rejects this program as expected.
Code
// Pins: a call-site bind on a phantom-minting bare-return HEAD is refused
// when the obligation it carries is never discharged — and the refusal names
// the AUTHOR'S binding (`c`), not the resource's type. A sole `| made`
// continuation is illegal; this is `create(...): c |>`.
//
// Auto-discharge is disabled so the wall is under test rather than the LIFO
// insertion — with the flag on, insertion emits the cleanup and the question
// never reaches the checker.
const std = @import("std");
const Resource = struct { value: i32 };
~pub tor create { value: i32 } -> *Resource<state_a!>
~proc create|zig {
const r = std.heap.page_allocator.create(Resource) catch unreachable;
r.* = Resource{ .value = value };
return r;
}
~pub tor cleanup { r: *Resource<!state_a> }
~proc cleanup|zig {
std.debug.print("cleaned {d}\n", .{r.value});
std.heap.page_allocator.destroy(r);
}
~pub tor peek { r: i32 }
~proc peek|zig {
std.debug.print("peek {d}\n", .{r});
}
~create(value: 7): c |> peek(r: c.value)
Actual compiler output
error[KORU030]: Resource 'c' carries obligation <state_a!> was not discharged. Call one of: input:cleanup
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_122_head_label_bind_obligation_undischarged/input.kz:34:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must contain:
Resource 'c' carries obligation <state_a!> was not dischargedFlows
flow ~create click a branch to expand · @labels scroll to their anchor
create (value: 7)
Test Configuration
MUST_ERROR
Compiler Flags:
--auto-discharge=disable