✓
Passing This code compiles and runs correctly.
Code
// TEST: Reject obligation issuance [state!] on input parameters
//
// The ! suffix means "issue obligation" - this only makes sense on OUTPUT.
// On INPUT, you can:
// - [state] = require this state (no obligation transfer)
// - [!state] = consume an existing obligation
//
// But [state!] on input is semantically invalid - you can't "issue" an
// obligation on something you receive.
//
// MUST_FAIL: Cannot issue obligation
const Connection = struct { id: i32 };
// INVALID: [connected!] on input tries to issue an obligation
// This should be either [connected] (require state) or [!connected] (consume)
~pub event use_connection { conn: *Connection[connected!] }
| done
~proc use_connection {
return .{ .done = .{} };
}
pub fn main() void {}
Error Verification
Expected Error Pattern
Cannot issue obligationActual Compiler Output ✓ Pattern matched
error[KORU033]: Cannot issue obligation '[connected!]' on input parameter (event: use_connection). Use '[!connected]' to consume an existing obligation, or remove the '!' suffix.
--> phantom_semantic_check:20:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_058_reject_issue_on_input/backend.zig:9303:17: 0x104e464af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_058_reject_issue_on_input/backend.zig:9387:28: 0x104e472b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL