✓
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
// from a fixed pool collide when a later splice adds another hop at the
// same depth). The fix names each expand result after the path it walks;
// 620_003 covers the origin case, this covers the chain case. Both were
// originally written with `| line r` — the bare-return branch form the
// shape checker now refuses — and bind `: r` instead.
import app/net
import std/fmt
import std/io
app/net:connect(host: "localhost")
| ok c |> std/fmt:ln("GET /conn/{{ c:d }}"): req
|> std/fmt:ln("wrapped: {{ req.text:s }}"): 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 tor connect { host: string }
| ok i32
| err string
~proc connect|zig {
_ = host;
return .{ .ok = 7 };
}
~pub tor write { conn: i32, data: string }
| ok i32
| err string
~proc write|zig {
std.debug.print("write: {s}\n", .{data});
return .{ .ok = conn };
}
~pub tor read { conn: i32 }
| ok { conn: i32, n: i32 }
| err string
~proc read|zig {
std.debug.print("read from conn {d}\n", .{conn});
return .{ .ok = .{ .conn = conn, .n = 42 } };
}
~pub tor shutdown { conn: i32 }
| ok
| err string
~proc shutdown|zig {
std.debug.print("shutdown conn {d}\n", .{conn});
return .{ .ok = .{} };
}
Test Configuration
MUST_RUN