006 identity branch phantom

✓ Passing This code compiles and runs correctly.

Code

// Test: Identity branches with phantom types in runtime dispatcher
// The runtime dispatcher must handle identity branches (bare types, not structs)

~import "$std/runtime"
~import "$std/io"

// Identity branch with phantom annotation
~pub event create {}
| handle []const u8[active!]

~create = handle "resource_1"

// Discharge event
~pub event destroy { h: []const u8[!active] }

~proc destroy {
    std.debug.print("destroyed: {s}\n", .{h});
}

const std = @import("std");

~std.runtime:register(scope: "test") {
    create(10)
    destroy(1)
}

const TEST_SOURCE = "~create()\n| handle h |> result { id: h }";

~std.runtime:run(source: TEST_SOURCE, scope: "test", budget: 100)
| result _ |> std.io:print.ln("PASS: got handle")
| exhausted _ |> std.io:println(text: "FAIL: exhausted")
| parse_error _ |> std.io:println(text: "FAIL: parse_error")
| validation_error _ |> std.io:println(text: "FAIL: validation_error")
| event_denied _ |> std.io:println(text: "FAIL: event_denied")
| dispatch_error _ |> std.io:println(text: "FAIL: dispatch_error")
| scope_not_found _ |> std.io:println(text: "FAIL: scope_not_found")
input.kz

Test Configuration

MUST_RUN