✓
Passing This code compiles and runs correctly.
Code
// Test 310_042: Transition Metatype Variable Binding
//
// Tests that Transition metatype variables are properly accessible in tap handlers.
// Transition provides: source (event name), branch (branch taken), destination (next event)
//
// This isolates the metatype binding issue from wildcard pattern matching.
// The tap pattern is simple (concrete: hello -> *) so we're ONLY testing
// that the metatype variable 't' is accessible in the handler invocation.
const std = @import("std");
~import "$std/taps"
~event hello {}
| done {}
~event goodbye {}
| done {}
~event logger {}
| done {}
~proc hello {
std.debug.print("Hello\n", .{});
return .{ .done = .{} };
}
~proc goodbye {
std.debug.print("Goodbye\n", .{});
return .{ .done = .{} };
}
~proc logger {
std.debug.print("[TRANSITION] captured\n", .{});
return .{ .done = .{} };
}
// Simple tap on concrete event with Transition metatype
// If this works, metatype binding is OK - the variable 't' is accessible
// If this fails with "undeclared identifier 't'", metatype binding is broken
~tap(hello -> *)
| Transition _ |> logger()
| done |> _
~hello()
| done |> goodbye()
| done |> _
Expected Output
Hello
[TRANSITION] captured
Goodbye
Test Configuration
MUST_RUN