✓
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
// Bare return with phantom obligation (the migrated form of an identity branch)
~pub tor create {} -> string<active!>
~create -> "resource_1"
// Discharge event
~pub tor destroy { h: string<!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()";
~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
Expected output
destroyed: resource_1
[AUTO-DISCHARGE] Invoked 'destroy' for handle 'resource_1' [main:active]
PASS: got handle
Flows
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "test", source: create(10)
destroy(1))
flow ~run click a branch to expand · @labels scroll to their anchor
run (source: TEST_SOURCE, scope: "test", budget: 100)
Test Configuration
MUST_RUN