✓
Passing Passing: the compiler rejects this program as expected.
Code
// PIN: a phantom state qualified with the SAME module its base type already
// names is REDUNDANT and is refused (KORU116) with a teaching diagnostic
// ("bare `<!active>` already scopes to the base type's module `app/lib/db` —
// drop the qualifier"). One-canonical-spelling: there is exactly ONE way to
// write "app/lib/db's active on app/lib/db's Transaction" — the bare form
// (330_087-style base-type-module self-resolution). Contrast 330_087
// (qualifying a FOREIGN module's state on a primitive base — required, not
// redundant) and 690_037 (`Store<std/store:!taken>` — type home ≠ state home).
~import std/io
~import app/lib/db
// REDUNDANT: `*app/lib/db:Transaction` already names app/lib/db; re-qualifying
// the state `<app/lib/db:!active>` restates it. Should be `<!active>` (bare).
~tor finish { t: *app/lib/db:Transaction<app/lib/db:!active> }
~proc finish|zig {
return;
}
~app/lib/db:begin(): tx |> finish(t: tx) |> std/io:print.ln("ok")
Supporting Files
// A module that declares a resource TYPE with intrinsic typestate. `active` is
// app/lib/db's own state, issued bare in-module (self-resolves to app/lib/db).
const std = @import("std");
const Transaction = struct { id: i32 };
~pub tor begin { } -> *Transaction<active!>
~proc begin|zig {
const t = std.heap.page_allocator.create(Transaction) catch unreachable;
t.* = .{ .id = 1 };
return t;
}
Actual compiler output
error[KORU116]: redundant phantom qualifier: bare '<!active>' already scopes to the base type's module 'app/lib/db' — drop the qualifier
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_112_reject_redundant_phantom_qualification/input.kz:13:0
|
13 | // the state `<app/lib/db:!active>` restates it. Should be `<!active>` (bare).
| ^
hint: write <!active>; qualify a phantom only when its home differs from the type'sFrontend must reject with:
CONTAINS redundantFlows
flow ~begin click a branch to expand · @labels scroll to their anchor
begin
Test Configuration
MUST_ERROR