✓
Passing Passing: the compiler rejects this program as expected.
Code
// A bare return `-> T` and named `|` outcome branches are different
// contracts: `return_type` wins, and every declared `| branch` parses into
// the EventDecl yet can never be armed at a call site — KORU021 reports
// "a bare return has no tags". Declared vocabulary that cannot be spelled
// refuses at the declaration, not downstream of it. `| ?!` panic arms are
// refused too — they join the outcome union while the bare return emits an
// empty tag (210_310). The legal mix pinned by control: `-> T` + `!`
// effect arms (210_189, pump `! ?polled` decls) — yields, not outcomes.
import std/io
tor probe { n: u32 } -> u32
| failed string
| blocked
proc probe|zig {
return n;
}
probe(n: 3)
| ok r |> std/io:print.ln("got {{ r:d }}")
Actual compiler output
error[PARSE003]: tor 'probe' declares a bare return `-> u32` AND named `| failed` outcomes — a bare return has no tags, so every declared branch is unreachable at the call site. Pick one contract: `-> T` alone, or named `| branch` outcomes with no `->`
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_309_bare_return_with_named_branches/input.k:11:1
|
11 | tor probe { n: u32 } -> u32
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS a bare return has no tags
NOT_CONTAINS output_emitted.zigTest Configuration
MUST_ERROR