✓
Passing Passing: the compiler rejects this program as expected.
Code
// GUARD — ambiguity must keep forcing an explicit binding.
//
// `merge` consumes two same-typed handles and mints one; there is no sole
// survivor, so `a` must NOT continue (the result could be `a`, `b`, or new).
// The continuation rule is arity-bounded: name the survivor only when one is
// left. Here two were consumed, so `a` is spent and `close(a)` must be refused.
//
// Green today and must STAY green when the continuation rule lands — this is
// the negative space that keeps the rule from over-applying.
import app/held
import std/io
app/held:open()
| opened a |> app/held:open()
| opened b |> app/held:merge(a, b): m |> app/held:close(h: a)
| err e |> std/io:print.ln("err: {{ e:s }}")
| err e |> std/io:print.ln("err: {{ e:s }}")
Supporting Files
// The AMBIGUITY boundary: two same-typed handles consumed, ONE minted. There is
// no SOLE same-typed survivor, so the continuation rule must not fire — neither
// `a` nor `b` may quietly continue; the caller binds the result explicitly.
const std = @import("std");
pub const Handle = struct { _token: u8 };
~pub tor open { }
| opened *Handle<open!>
| err string
~proc open|zig {
const h = std.heap.page_allocator.create(Handle) catch unreachable;
h.* = Handle{ ._token = 0 };
return .{ .opened = h };
}
~pub tor merge { a: *Handle<!open>, b: *Handle<!open> } -> *Handle<open!>
~proc merge|zig {
std.heap.page_allocator.destroy(b);
return a;
}
~pub tor close { h: *Handle<!open|!active> }
~proc close|zig {
std.heap.page_allocator.destroy(h);
}
Actual compiler output
error[KORU030]: Use-after-discharge: binding 'a' was already discharged and cannot be used
--> tests/regression/300_ADVANCED_FEATURES/336_OBLIGATION_MATRIX/336_011_ambiguous_survivor_forces_explicit_binding/input.k:15:4
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must contain:
binding 'a' was already dischargedFlows
flow ~open click a branch to expand · @labels scroll to their anchor
open
Test Configuration
MUST_ERROR