✓
Passing This code compiles and runs correctly.
Code
~import "$std/io"
const std = @import("std");
const File = struct { handle: i32 };
~event open { path: []const u8 }
| opened *File[opened!]
~proc open {
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
~event close { file: *File[!opened] }
~proc close {
std.heap.page_allocator.destroy(file);
}
~event flush_close { file: *File[!opened] }
~proc flush_close {
std.heap.page_allocator.destroy(file);
}
~open(path: "test.txt")
| opened _ |> _
Error Verification
Actual Compiler Output
error[KORU030]: Resource '_auto_6' [opened!] has multiple disposal options: close, flush_close. Discharge explicitly.
--> auto_discharge:20:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_028_ambiguous_without_default/backend.zig:11356:17: 0x100dd64af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_028_ambiguous_without_default/backend.zig:11440:28: 0x100dd72b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL