✓
Passing Passing: the compiler rejects this program as expected.
Code
// A subflow produce cannot pack a phantom-LESS value into a `<state!>`-
// declared record field — `h` was never acquired as an obligation, so there
// is nothing live to hand the caller. The declared record return is a
// checked contract at the produce edge, not a claim the caller's seeded
// `s.<field>` debts can silently launder (800_010 deadbolt frontier 1: the
// call-site seeding that believes the declared type only stays sound while
// the pack verifies the feeder).
~import std/io
const std = @import("std");
const Handle = struct { n: i32 };
~tor mint-raw { id: usize } -> *Handle
~proc mint-raw|zig { const h = std.heap.page_allocator.create(Handle) catch unreachable; h.* = .{ .n = 5 }; return h; }
~tor pack { id: usize } -> { h: *Handle<owned!>, n: i64 }
~pack = mint-raw(id): h -> { h, n: 7 }
~pack(id: 1): s |> std/io:print.ln("n={{ s.n:d }}")
Actual compiler output
error[KORU030]: Produced record field 'h' is declared <input:owned!> but 'h' holds no live obligation to hand the caller — it was never acquired or has already been discharged.
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_140_obligation_record_field_phantomless_pack_refused_at_produce/input.kz:16:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
subflow ~pack click a branch to expand · @labels scroll to their anchor
mint-raw (id)
flow ~pack click a branch to expand · @labels scroll to their anchor
pack (id: 1)
Test Configuration
MUST_ERROR