✓
Passing This code compiles and runs correctly.
Code
// This test verifies that the phantom semantic checker reports ALL errors in a single pass
// rather than stopping at the first error
pub const File = struct {
handle: usize,
};
~event open_file { path: []const u8 }
| opened *File[open]
~event close_file { file: *File[closed] }
| done
~event read_file { file: *File[open] }
| done
~event write_file { file: *File[open] }
| done
~proc open_file {
const f = File{ .handle = 42 };
return .{ .opened = &f };
}
~proc close_file {
_ = file;
return .{ .done = .{} };
}
~proc read_file {
_ = file;
return .{ .done = .{} };
}
~proc write_file {
_ = file;
return .{ .done = .{} };
}
// Flow 1: ERROR - Passing [open] file to close_file expecting [closed]
~open_file(path: "test1.txt")
| opened o |> close_file(file: o.file)
| done |> _
// Flow 2: ERROR - Passing [open] file to close_file expecting [closed]
~open_file(path: "test2.txt")
| opened o |> close_file(file: o.file)
| done |> _
// Flow 3: ERROR - Passing [open] file to close_file expecting [closed]
~open_file(path: "test3.txt")
| opened o |> close_file(file: o.file)
| done |> _
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:42: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:47: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:52: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:9616:17: 0x1002164af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/920_multiple_errors/backend.zig:9700:28: 0x1002172b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL