✓
Passing Passing: the compiler rejects this program as expected.
Code
const std = @import("std");
const Connection = struct { id: i32 };
~pub tor query { conn: *Connection<connected>, sql: string }
~proc query|zig {
}
~pub tor get-raw-connection {} -> *Connection
~proc get-raw-connection|zig {
const c = std.heap.page_allocator.create(Connection) catch unreachable;
c.* = Connection{ .id = 1 };
return c;
}
~get-raw-connection(): c |> query(conn: c, sql: "SELECT 1")
Actual compiler output
error[KORU030]: Phantom state mismatch: argument 'conn' has no tracked phantom state, but this event requires state '<connected>'.
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_060_reject_state_mismatch_on_input/input.kz:12:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must fail at runtime:
Program must error when executed.
Expected patterns
Each line is a regex that must match the compiler error output.
# Test 330_060: Phantom state mismatch on event input
#
# INTENT: `query` declares `conn: *Connection<connected>` but the
# call site passes `c` from `get-raw-connection`, which returns a
# bare, unstated handle (`-> *Connection`). The phantom checker must
# reject this at semantic time with a clear KORU diagnostic about
# the missing required state, pointing at the user's source.
#
# HISTORY: written 2026-07-24 against the pre-bare-return flow grammar
# (`| ok c |> ...`); PARSE003 refused that spelling from 2026-08-18,
# so the pin could not reach its target. Re-spelled 2026-08-25 to the
# bare-return binding form grounded on 330_123 (`~make(): h |> bump(h)`)
# and 330_027 (word-state `<connected>` as required non-cleanup input).
# On re-measurement the checker DOES refuse — KORU030 "Phantom state
# mismatch: argument 'conn' has no tracked phantom state" — so this pin
# is now GREEN: input-side state enforcement exists for unstated handles.
error\[KORU\d+\]
phantom state
connected
input\.kzFlows
flow ~get-raw-connection click a branch to expand · @labels scroll to their anchor
get-raw-connection
Test Configuration
MUST_ERROR