phantom state valid

✗ 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/910_phantom_state_valid/backend.zig:9407:17: 0x10275a4af in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/910_phantom_state_valid/backend.zig:9491:28: 0x10275b2b7 in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Code

// Test 910: Phantom State Valid Transitions
//
// Validates that phantom state transitions work correctly when states match.
//
// This test shows the happy path:
// - open_file returns *File[open]
// - close_file accepts *File[open] and returns *File[closed]
// - States match, compilation succeeds!

const std = @import("std");

~event open_file {}
| opened *std.fs.File[open]

~proc open_file {
    std.debug.print("File opened\n", .{});
    const allocator = std.heap.page_allocator;
    const f = allocator.create(std.fs.File) catch unreachable;
    return .{ .opened = f };
}

~event close_file { file: *std.fs.File[open] }
| closed *std.fs.File[closed]

~proc close_file {
    std.debug.print("File closed\n", .{});
    return .{ .closed = file };
}

// This flow should SUCCEED: [open] → close_file accepts [open] → returns [closed]
~open_file()
| opened o |> close_file(file: o)
    | closed _ |> _
input.kz

Expected

File opened
File closed

Test Configuration

MUST_RUN