✗
Failing This test is currently failing.
Failed: backend-exec
Error Details
output_emitted.zig:55:21: error: expected optional type, found 'fn (i64) i64'
Failure Output
Showing last 10 of 14 lines
referenced by:
flow0: output_emitted.zig:67:57
main: output_emitted.zig:524:22
4 reference(s) hidden; use '-freference-trace=6' to see all references
output_emitted.zig:65:28: error: function with non-void return type 'i64' implicitly returns
fn ask(_: i64) i64 {}
^~~
output_emitted.zig:65:33: note: control flow reaches end of body here
fn ask(_: i64) i64 {}
^ Code
// OPTIONAL RESUME ARMS, proc side — designed 2026-07-03. A `~proc |zig` impl
// gets the presence truth as a NULLABLE FUNCTION POINTER alias: for an
// optional arm the emitter binds
// const ask: ?*const fn (...) T = if (@hasDecl(__H, "ask")) &__H.ask else null;
// instead of today's synthesized no-op (which is invalid Zig for any
// value-resuming arm, and poisons @hasDecl for all of them). The proc then
// writes idiomatic Zig: `if (ask) |f| ...` — comptime-known null, folds away.
//
// This consumer OMITS the handler, so the unwrap fails and the proc's own
// explicit fallback wins: prints 0.
~import std/io
~pub event query { q: i64 }
! ?ask i64 -> i64
| done i64
~proc query|zig {
if (ask) |f| {
return .{ .done = f(q) };
}
return .{ .done = 0 };
}
~query(q: 41)
| done r |> std/io:print.ln("{{ r:d }}")
Expected output
0
Flows
flow ~query click a branch to expand · @labels scroll to their anchor
query (q: 41)
Test Configuration
MUST_RUN