✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
Showing last 10 of 38 lines
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_052_escape_field_name_mismatch/backend.zig:9575:51: 0x1020f7077 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^
/opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:627:37: 0x1020fe64b in main (backend)
const result = root.main() catch |err| {
^
???:?:?: 0x19815dd53 in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 33: 85572 Abort trap: 6 ./backend output Code
// FIXED: Escape checker now matches by value, not field name
//
// Previously: Obligation escape via branch constructor required the output field
// name to match the binding path. Now it correctly checks the VALUE being passed.
//
// - open() returns { file: *File[opened!] }
// - get_resource returns { resource: *File[opened!] } <- different name!
// - Subflow passes f.file to field 'resource'
//
// Expected: Should compile - obligation escapes via branch constructor
// Actual: Fails with "Resource 'f.file' was not disposed"
//
// The escape should be recognized by VALUE, not by field NAME.
const std = @import("std");
const File = struct { handle: i32 };
~event open { path: []const u8 }
| opened *File[opened!]
~proc open {
std.debug.print("opened: {s}\n", .{path});
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
~event close { file: *File[!opened] }
| closed
~proc close {
std.debug.print("closed\n", .{});
std.heap.page_allocator.destroy(file);
return .{ .closed = .{} };
}
// This event uses a DIFFERENT field name than open's output
~event get_resource { path: []const u8 }
| got *File[opened!]
// BUG: f.file -> resource field name mismatch causes escape to not be recognized
~get_resource = open(path: path)
| opened f |> got { resource: f.file }
// Main flow with explicit cleanup
~get_resource(path: "test.txt")
| got r |>
close(file: r.resource)
| closed |> _
pub fn main() void {}
Expected
opened: test.txt
closed
Test Configuration
MUST_RUN