✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
error[KORU030]: Phantom state mismatch: 'f.file1' (parameter 'file') holds no live '<opened!>' obligation to consume here — it was never acquired or has already been discharged. Pass a value that still holds its '<opened!>' obligation.
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/520_multiple_resources_cleanup/input.kz:3:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace) Code
~import app/fs
~app/fs:open-two(path1: "test1.txt", path2: "test2.txt"): f |> app/fs:close(file: f.file1) |> app/fs:close(file: f.file2) // Close both files
Flows
flow ~open-two click a branch to expand · @labels scroll to their anchor
open-two (path1: "test1.txt", path2: "test2.txt")
Imported Files
const std = @import("std");
const File = struct { handle: i32 };
~pub tor open-two { path1: string, path2: string } -> { file1: *File<opened!>, file2: *File<opened!> } // TWO obligations!
~proc open-two|zig {
std.debug.print("Opening two files: {s}, {s}\n", .{path1, path2});
const allocator = std.heap.page_allocator;
const f1 = allocator.create(File) catch unreachable;
const f2 = allocator.create(File) catch unreachable;
f1.* = File{ .handle = 42 };
f2.* = File{ .handle = 43 };
return .{ .file1 = f1, .file2 = f2 };
}
~pub tor close { file: *File<!opened> } // Consumes one obligation
~proc close|zig {
std.debug.print("Closing file\n", .{});
}