✓
Passing Passing: the compiler rejects this program as expected.
Code
// PIN (phantom_semantic_checker — mirror of 330_110): an OUTPUT/return may ISSUE
// an obligation (<owned!>) or produce-in-state (<owned>), but may NEVER CONSUME
// one (<!owned>). A discharge consumes an INCOMING obligation; a return has
// nothing incoming to consume, so <!owned> in output is a discharge placed where
// only an issue belongs — nonsense. (Prefix-! reads as discharge, suffix-! as
// issue: the position IS the polarity.)
//
// Desired: a clear polarity rejection at the SEMANTIC phantom checker (not the
// parser). Roadmap red until the wall exists. [diagnostic wording Lars's to finalize]
~import std/io
const std = @import("std");
const Handle = struct { n: i32 };
~tor weird { } -> *Handle<!owned>
~proc weird|zig { const h = std.heap.page_allocator.create(Handle) catch unreachable; h.* = .{ .n = 1 }; return h; }
~weird(): h |> std/io:print.ln("returned a consumed-in-output handle")
Actual compiler output
error[KORU033]: Cannot consume obligation '<!owned>' on output parameter (event: weird). Use '<owned!>' to issue a new obligation, or remove the '!' prefix.
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_111_reject_consume_obligation_in_output/input.kz:14:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace)Backend must reject with:
CONTAINS error[KORU033]
CONTAINS Cannot consume obligationFlows
flow ~weird click a branch to expand · @labels scroll to their anchor
weird
Test Configuration
MUST_ERROR