✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a `|>` produce with no name that reaches a step whose parameters are
// ALL written is computed and dropped — the conveyor loses its cargo with no
// refusal and no way to ever reference the value. The thread's no-destination
// refusal must fire here exactly as it fires for a type mismatch (210_181):
// zero open slots is zero candidates.
//
// The deliberately-spelled escapes stay legal: bind the produce and write it
// (`produce(): s |> f(a: s)` — 210_323), or drop it at the source (`:_`).
import std/io
tor other {} -> string
proc other|zig { return "other"; }
tor produce {} -> string
proc produce|zig { return "made"; }
tor consume { a: string } -> string
proc consume|zig { return a; }
other(): o |> produce() |> consume(a: o): r
|> std/io:print.ln("{{ r:s }}")
Actual compiler output
error[KORU092]: the string produced by 'produce' has nowhere to land — every parameter downstream that could take it is already written
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_322_unbound_produce_dead_at_complete_call/input.k:20:0
|
20 | other(): o |> produce() |> consume(a: o): r
| ^
hint: leave the slot that should take it unfilled so the thread elects it, or drop the value at its source with `: _`. An unnamed produce cannot be referenced; `|>` forwards it or refuses.Must fail at frontend compile:
Parsing or type-checking must reject the program.
Error output must contain
KORU092Flows
flow ~other click a branch to expand · @labels scroll to their anchor
other
Test Configuration
MUST_ERROR LANGUAGES: zig