✓
Passing This code compiles and runs correctly.
Code
// Shape-destructure at the binding position: fields bind the payload's
// same-named fields directly — by NAME, never position. Selective
// destructure (omitting fields) is the same semantics as partial field
// use on a whole-payload binding. A when-guard sees destructured names.
// A type on a field is a CHECKED ASSERTION (typed const; Zig validates).
~import std/io
~pub event fetch { id: i64 }
| found { name: []const u8, age: i64 }
| missing
~proc fetch|zig {
if (id == 1) return .{ .found = .{ .name = "lars", .age = 44 } };
return .{ .missing = .{} };
}
~fetch(id: 1)
| found { name, age: i64 } when age > 40 |> std/io:print.ln("elder {{ name:s }} {{ age:d }}")
| found { name } |> std/io:print.ln("younger {{ name:s }}")
| missing |> std/io:print.ln("nope")
Actual
elder lars 44
Expected output
elder lars 44
Test Configuration
MUST_RUN