✓
Passing Passing: the compiler rejects this program as expected.
Code
// TEST: fmt:ln scoped borrow — param-wall laundering is refused.
//
// `.text` carries scratch@scoped. `identity`'s param `data: string`
// declares no scoped acceptance, so the argument `l.text` refuses at the
// call wall (KORU030) before the callee ever binds it — the class follows
// the value through the projection (the carrier `l` is the classed
// binding), and only a param spelled `string<*@scoped>` could take it.
import std/fmt
import std/io
tor identity { data: string } -> string
identity = std/io:print.ln(data): _ -> data
std/fmt:ln("item {{ 1:d }}"): l |> identity(data: l.text): d |> std/io:print.ln(d)
Actual compiler output
error[KORU030]: argument 'l.text' is @scoped — it dies with its frame and parameter 'data' declares no scoped acceptance. Declare it 'string<*@scoped>' (the borrow stays confined inside the callee), or copy it out first (std/string:from-page + take / fmt.blk)
--> tests/regression/600_STDLIB/620_FMT/620_013_fmt_ln_scoped_param_laundering/input.k:15:1Must fail at runtime:
Program must error when executed.
Error output must contain
declares no scoped acceptanceFlows
subflow ~identity 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