✓
Passing This code compiles and runs correctly.
Code
// Test 227: Namespace handling in nested flows
//
// Verifies that namespaced events (net.connect, net.send) lower correctly
// through a nested flow: the connect outcome is bound and threaded into the
// send call, and both namespaced proc bodies emit and run end-to-end.
//
// Proc bodies access the event payload by field name (host, id, data) — the
// `e.<field>` alias form is not part of the language and must not appear in
// test code or examples.
const std = @import("std");
// Events with namespace
~event net.connect { host: []const u8 }
| connected u32
| failed []const u8
~event net.send { id: u32, data: []const u8 }
| sent usize
| failed []const u8
~proc net.connect|zig {
std.debug.print("Connecting to {s}\n", .{host});
return .{ .@"connected" = 42 };
}
~proc net.send|zig {
std.debug.print("Sending {} bytes on connection {}\n", .{data.len, id});
return .{ .@"sent" = data.len };
}
// Nested flow with namespaced events: connect, bind the result, thread into send
~net.connect(host: "localhost")
| connected c |> net.send(c, data: "hello")
| sent _ |> _
| failed _ |> _
| failed _ |> _
Actual
Connecting to localhost
Sending 5 bytes on connection 42
Expected output
Connecting to localhost
Sending 5 bytes on connection 42
Test Configuration
MUST_RUN