✓
Passing Passing: the compiler rejects this program as expected.
Code
import std/fmt
import std/io
// The other half of declared conferral: `data` binds scoped inside the
// callee, so producing it out through a PLAIN `-> string` output refuses —
// only a declared `-> string<*@scoped>` output may carry the class on.
tor launder { data: string<*@scoped> } -> string
launder = std/io:print.ln(data): _ -> data
std/fmt:ln("item {{ 1:d }}"): l |> launder(data: l.text): d |> std/io:print.ln(d)
Actual compiler output
error[KORU030]: 'data' is @scoped — it dies with this frame and may not be produced out. Consume it in place, or copy it out first (std/string:from-page + take / fmt.blk)
--> tests/regression/600_STDLIB/620_FMT/620_015_fmt_ln_scoped_param_produce_out/input.k:8:1Must fail at runtime:
Program must error when executed.
Error output must contain
may not be produced outFlows
subflow ~launder click a branch to expand · @labels scroll to their anchor
print.ln (expr: data)
flow ~ln click a branch to expand · @labels scroll to their anchor
ln ("item {{ 1:d }}")
Test Configuration
MUST_ERROR