✓
Passing This code compiles and runs correctly.
Code
// TEST: TWO chained std/fmt:ln hops — the [expand] result constant must be
// unique per splice, not a fixed name.
//
// Sibling facet of 620_003 (same root defect: [expand] splice result names
// minted outside the function-global counter). With a fixed name, the second
// splice's switch nests inside the first's arm and Zig rejects:
//
// error: local constant '__expand_result' shadows local constant from outer scope
//
// The fix mints __expand_result_<N> from the shared result counter, so any
// chain depth of [expand] splices stays shadow-free.
~import app/net
~import std/fmt
~app/net:connect(host: "localhost")
| ok c |> std/fmt:ln("GET /conn/{{ c:d }}")
| line req |> std/fmt:ln("wrapped: {{ req.text:s }}")
| line req2 |> app/net:write(conn: c, data: req2.text)
| ok w |> app/net:read(conn: w)
| ok r |> app/net:shutdown(r.conn)
| ok |> _
| err _ |> _
| err _ |> _
| err _ |> _
| err _ |> _
Actual
write: wrapped: GET /conn/7
read from conn 7
shutdown conn 7
Expected output
write: wrapped: GET /conn/7
read from conn 7
shutdown conn 7
Flows
flow ~connect click a branch to expand · @labels scroll to their anchor
connect (host: "localhost")
Imported Files
// Minimal network-shaped module: a chain of branch-outcome events
// (connect -> write -> read -> shutdown) with | ok / | err branches,
// used to pin the emitter result_N collision when a std/fmt:ln hop
// is spliced into the chain.
const std = @import("std");
~pub event connect { host: []const u8 }
| ok i32
| err []const u8
~proc connect|zig {
_ = host;
return .{ .ok = 7 };
}
~pub event write { conn: i32, data: []const u8 }
| ok i32
| err []const u8
~proc write|zig {
std.debug.print("write: {s}\n", .{data});
return .{ .ok = conn };
}
~pub event read { conn: i32 }
| ok { conn: i32, n: i32 }
| err []const u8
~proc read|zig {
std.debug.print("read from conn {d}\n", .{conn});
return .{ .ok = .{ .conn = conn, .n = 42 } };
}
~pub event shutdown { conn: i32 }
| ok
| err []const u8
~proc shutdown|zig {
std.debug.print("shutdown conn {d}\n", .{conn});
return .{ .ok = .{} };
}
Test Configuration
MUST_RUN