✓
Passing Passing: the compiler rejects this program as expected.
Code
// 400_171 — `!` (effect marker) on an OUTCOME branch is a kind error.
// `take` returns one outcome branch, `| item`. Writing `! item` (the effect
// marker) is a marker/kind mismatch: `!` and `|` are separate KINDS (effect vs
// continuation), and a call site must use the marker matching the branch's
// declared kind. Left unchecked the mismatch miscompiles — the owned obligation
// (`free(s: taken.label)`) silently fails to discharge and the program leaks —
// so koru rejects it with KORU025 where take's generated outcome event first
// exposes its branch kinds: the phantom semantic checker.
import std/string
import std/store
std/store:new(todos, capacity: 8) { label: *std/string:String<std/string:instance!> }
std/string:from-page(text: "x")
| ok s |> std/string:take(s): owned |> std/store:insert(todos) { label: owned }
| row r |> std/store:take(todos[r])
! item taken |> std/string:free(s: taken.label)
| err _ |> _
Actual compiler output
error[KORU025]: branch 'item' is declared as terminal `|` but the handler uses effect `!`
--> tests/regression/400_RUNTIME_FEATURES/400_171_effect_marker_on_outcome_branch_rejected/input.k:16:8
hint: match the handler glyph to the declaration: write `| item ... |> ...` to handle this branch
❌ Compiler coordination error: Incomplete branch coverage
(set KORU_BACKEND_TRACE=1 for the backend return trace)Must fail at runtime:
Program must error when executed.
Error output must contain
branch 'item' is declared as terminal `|` but the handler uses effect `!`Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (todos, capacity: 8, source: label: *std/string:String<std/string:instance!>)
flow ~from-page click a branch to expand · @labels scroll to their anchor
from-page (text: "x")
Test Configuration
MUST_ERROR