✓
Passing This code compiles and runs correctly.
Code
// Pins that a tagged-union arm payload binding named after a Zig primitive
// reaches the emitted Zig safely — declaration AND references.
//
// `u2` is a legal Koru identifier and a primitive int type in Zig. The arm
// alias `const u2 = u2_N` fails `name shadows primitive 'u2'`; and even
// escaped, bare `u2` in arg text still resolves to the primitive — Zig probe
// 2026-11-10: `const @"u2"` does not capture bare `u2` references.
//
// Sibling: 230_018 pins the call-site `: bind` twin; 230_017 the keyword
// twin for tor params. Shape mirrors 400_229 — nested unions, shared arm
// name, payload binding consumed by a call arg (`free(content: u2)`).
//
// Expected: prints `ok`.
~import std/io
~pub tor first { } | same | diff
~proc first|zig {
return .{ .same = .{} };
}
~pub tor second { }
| same string<std/io:allocated!>
| other string<std/io:allocated!>
~proc second|zig {
return .{ .same = koru_allocator().dupe(u8, "payload") catch @panic("oom") };
}
~pub tor go { }
| ok
| err string<std/io:allocated!>
~go = first()
| diff => ok
| same |> second()
| same u2 |> std/io:free(content: u2) => ok
| other u2 |> std/io:free(content: u2) => ok
~go()
| ok |> std/io:print.ln("ok")
| err e |> std/io:print.ln("err")
Actual
ok
Expected output
ok
Flows
subflow ~go click a branch to expand · @labels scroll to their anchor
first
flow ~go click a branch to expand · @labels scroll to their anchor
go
Test Configuration
MUST_RUN