✓
Passing This code compiles and runs correctly.
Code
~import app/fs
~app/fs:open(path: "test.txt")
| opened _ |> _
Must contain:
was not dischargedError Verification
Expected Error Pattern
MUST_FAILActual Compiler Output
error[KORU030]: Resource '_auto_0' with phantom state <opened!> was not discharged. No event accepts <!opened>.
--> auto_discharge:3: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_043_auto_discharge_none/backend.zig:94:13: 0x102bd63b3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_043_auto_discharge_none/backend.zig:190:28: 0x102bd709f in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Imported Files
// Library module: fs
// NO disposal event defined - should error
const std = @import("std");
const File = struct { handle: i32 };
// Open a file - returns opened! state (requires cleanup)
~pub event open { path: []const u8 }
| opened *File<opened!>
~proc open|zig {
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
// Oops! No close() or any event with [!opened] defined!
// This is a library bug - no way to satisfy the obligation
Test Configuration
MUST_FAIL
Expected Error:
No disposal event found