✓
Passing Passing: the compiler rejects this program as expected.
Code
// PIN (part + phantom): per-argument phantom-state checking must hold when
// the tors are declared in a `part` facet, not only in the primary file.
//
// Single-file sibling (330_093 shape): a binding re-minted `<bound!>` by a
// `->` return and then passed to a `<free>` borrow refused with KORU030
// "expected 'input:free' but got 'input:bound!'". Through `part comp` the
// same program compiled clean — arg-level checks resolve the tor decl via
// the writing module, and the merge puts the decl under the primary stem
// while the checker looks it up by the part's own module path (or skips
// decls not in the primary). Either way: a borrowed `<free>` accepted a
// `<bound!>` token, and `timeline.shift` ran on a bound timeline.
//
// MUST_ERROR stands: the borrowed-param state mismatch must refuse
// identically whether the decl lives in the primary or a part facet.
~part comp
~import std/io
~timeline.new(): verse
|> bind.it(tl: verse): bound
|> timeline.shift(tl: bound, delta: 1.0)
|> std/io:print.ln("unreachable — bound accepted by <free> borrow")
Supporting Files
pub tor timeline.new {} -> *Timeline<free!>
pub tor bind.it { tl: *Timeline<!free> } -> *Timeline<bound!>
pub tor timeline.shift { tl: *Timeline<free>, delta: f64 }
const std = @import("std");
pub const Timeline = struct { start: f64 };
~proc timeline.new|zig {
const t = std.heap.page_allocator.create(Timeline) catch @panic("x");
t.* = .{ .start = 0.0 };
return t;
}
~proc bind.it|zig { return tl; }
~proc timeline.shift|zig { _ = tl; _ = delta; }
Actual compiler output
error[KORU030]: Phantom state mismatch: expected 'input:free' but got 'input:bound!' for argument 'tl'
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_136_part_merged_phantom_arg_check/input.kz:21:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must contain:
Phantom state mismatchFlows
flow ~timeline.new click a branch to expand · @labels scroll to their anchor
timeline.new
Test Configuration
MUST_ERROR