✓
Passing This code compiles and runs correctly.
Code
// PINS: `@hasDecl(__H, "<arm>")` in a zig proc body survives the top-level
// inline splice — rewritten to `true` here, because this consumer INSTALLS
// the optional `! note` arm. The twin (400_178) omits it and pins `false`.
import std/io
import app/lib/streamer
app/lib/streamer:drip(n: 3)
! note i |> std/io:print.ln("note {{ i:d }}")
| done t |> std/io:print.ln("done {{ t:d }}")
Actual
note 0
note 1
note 2
done 3
Expected output
note 0
note 1
note 2
done 3
Flows
flow ~drip click a branch to expand · @labels scroll to their anchor
drip (n: 3)
Imported Files
// A `proc |zig` with a VOID optional arm whose body probes presence via
// `@hasDecl(__H, "<arm>")` — the proc-side presence spelling vaxis:run's
// tick gate uses. Sound on the Handlers-fn path, where `__H` is the
// synthesized comptime type. A TOP-LEVEL cross-module consumer takes the
// inline-splice path instead (400_176's note), where no `__H` exists — the
// splice must rewrite the probe to a literal true/false from the caller's
// installed arms, exactly as rewriteInlineHasDeclPresence already does for
// template-baked flow bodies (400_154 × 833). Before that rewrite reached
// proc bodies, this file's probe surfaced verbatim at the splice site:
// error: use of undeclared identifier '__H'
//
// Found in koru-libs/curl: `poll`/`await` gained a `! ?chunk` streaming arm
// whose drain must run ONLY when someone is listening (an unheard drain
// discards response bytes). Reproduced here with no curl.
~pub tor drip { n: i64 }
! ?note i64
| done i64
~proc drip|zig {
var total: i64 = 0;
var i: i64 = 0;
while (i < n) : (i += 1) {
if (@hasDecl(__H, "note")) {
note(i);
}
total += i;
}
return .{ .done = total };
}
Test Configuration
MUST_RUN