✓
Passing This code compiles and runs correctly.
Code
// A branch arm may produce a BRACED record for a named branch.
//
// `-> hit { label: "high", code: 1 }` read as an INVOCATION, because
// `name { … }` is also how you call something with a Source block and
// `looksLikeInvocation` was asked first. So a constructor became a call to a tor
// nobody declared, and the diagnostic said exactly that about a line that
// constructs.
//
// Nothing to do with named single outcomes — this is an ORDINARY two-branch
// tor, and it failed the same way. The first draft of this test named its
// branches `ok`/`bad` and collided with `std.testing:ok`, which is the tell: a
// branch constructor has no business being resolved against the stdlib at all.
//
// Twin of 210_190, which pins the same parse through the single-named-outcome
// surface. This one holds the plain case, so a regression cannot hide behind
// the newer feature.
~import std/io
~tor pick { n: i32 }
| high
| low
~proc pick|zig {
return if (n > 5) .high else .low;
}
~tor classify { n: i32 }
| hit { label: string, code: i32 }
| miss { label: string, code: i32 }
~classify =
pick(n)
| high -> hit { label: "high", code: 1 }
| low -> miss { label: "low", code: 0 }
~classify(n: 9)
| hit o |> std/io:print.ln("{{ o.label:s }}/{{ o.code:d }}")
| miss b |> std/io:print.ln("{{ b.label:s }}/{{ b.code:d }}")
Actual
high/1
Expected output
high/1
Flows
subflow ~classify click a branch to expand · @labels scroll to their anchor
pick (n)
flow ~classify click a branch to expand · @labels scroll to their anchor
classify (n: 9)
Test Configuration
MUST_RUN