✓
Passing This code compiles and runs correctly.
Code
~import "$std/io"
~import "$app/fs"
~app.fs:open(path: "test.txt")
| opened |> _ // ERROR: Flow ends with *File[opened!] not cleaned up!
Error Verification
Expected Error Pattern
Backend should fail - no disposal event available or multiple disposal optionsActual Compiler Output
error[KORU030]: branch 'opened' has payload but no binding
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_004_cleanup_obligation_escape/input.kz:4:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_004_cleanup_obligation_escape/backend.zig:11336:17: 0x100bc24af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_004_cleanup_obligation_escape/backend.zig:11420:28: 0x100bc32b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Imported Files
// Library module: fs
// Defines filesystem operations with cleanup obligations
const std = @import("std");
// File type with phantom states
const File = struct {
handle: i32,
};
// Open a file - returns opened! state (requires cleanup)
~pub event open { path: []const u8 }
| opened *File[opened!]
~proc open {
std.debug.print("Opening file: {s}\n", .{path});
const allocator = std.heap.page_allocator;
const f = allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
// Close a file - accepts opened state, returns closed state
~pub event close { file: *File[!opened] }
~proc close {
std.debug.print("Closing file\n", .{});
}
Test Configuration
MUST_FAIL