✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
Showing last 10 of 11 lines
--> phantom_semantic_check:32:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_008_obligation_escapes_via_interface/backend.zig:9487:17: 0x1003a24af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_008_obligation_escapes_via_interface/backend.zig:9571:28: 0x1003a32b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^ Code
// Test 517: Obligation escapes via interface
// Tests that obligations can escape through return signatures
//
// Key points:
// - my_subflow internally opens a file (via subflow composition)
// - my_subflow returns *File[opened!] in its signature
// - This documents that the obligation escapes
// - The CALLER receives the obligation and must handle it
// - Caller closes the file, satisfying the obligation
~import "$app/fs"
~app.fs:my_subflow()
| file_opened f |> app.fs:close(file: f)
| closed |> _
Expected
Opening file: data.txt
Closing file
Imported Files
const std = @import("std");
const File = struct { handle: i32 };
~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 };
}
~pub event close { file: *File[!opened] }
| closed
~proc close {
std.debug.print("Closing file\n", .{});
return .{ .closed = .{} };
}
// Subflow that opens a file and returns it with obligation
// The obligation escapes via the return signature - caller must handle it
~pub event my_subflow {}
| file_opened *File[opened!]
// SUBFLOW: Delegates to open, maps opened → file_opened
// The [opened!] obligation passes through to the caller
~my_subflow = open(path: "data.txt")
| opened f |> file_opened { file: f.file }
Test Configuration
MUST_RUN