✓
Passing This code compiles and runs correctly.
Code
pub const File = struct {
handle: usize,
};
~event open_file { path: []const u8 }
| opened *File[open]
~event close_file { file: *File[closed] }
~event read_file { file: *File[open] }
~event write_file { file: *File[open] }
~proc open_file {
const f = File{ .handle = 42 };
return .{ .opened = &f };
}
~proc close_file {
_ = file;
return .{ .done = .{} };
}
~proc read_file {
_ = file;
}
~proc write_file {
_ = file;
return .{ .done = .{} };
}
~open_file(path: "test1.txt")
| opened o |> close_file(file: o.file)
~open_file(path: "test2.txt")
| opened o |> close_file(file: o.file)
~open_file(path: "test3.txt")
| opened o |> close_file(file: o.file)
Error Verification
Expected Error Pattern
This test must fail with phantom state mismatch errors.
All three errors should be reported in a single compilation pass.Actual Compiler Output
error[KORU030]: Phantom state mismatch: argument 'file' has no tracked phantom state, but event requires '[closed]'. The value must be in state 'input:closed'.
--> phantom_semantic_check:25:0
error[KORU030]: Phantom state mismatch: argument 'file' has no tracked phantom state, but event requires '[closed]'. The value must be in state 'input:closed'.
--> phantom_semantic_check:27:0
error[KORU030]: Phantom state mismatch: argument 'file' has no tracked phantom state, but event requires '[closed]'. The value must be in state 'input:closed'.
--> phantom_semantic_check:29:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/920_multiple_errors/backend.zig:9543:17: 0x104ebe4af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/920_multiple_errors/backend.zig:9627:28: 0x104ebf2b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL