✓
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|zig {
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:print.ln("FAIL: exhausted")
| parse-error _ |> std/io:print.ln("FAIL: parse_error")
| validation-error _ |> std/io:print.ln("FAIL: validation_error")
| shape-error _ |> std/io:print.ln("FAIL: shape_error")
| event-denied _ |> std/io:print.ln("FAIL: event_denied")
| dispatch-error _ |> std/io:print.ln("FAIL: dispatch_error")
| scope-not-found _ |> std/io:print.ln("FAIL: scope_not_found")
Actual
destroyed: resource_1
[AUTO-DISCHARGE] Invoked 'destroy' for handle 'resource_1' [main:active]
PASS: got handle
Test Configuration
MUST_RUN