✓
Passing Passing: the compiler rejects this program as expected.
Code
// TEST: KORU095 — a `-> string` bare return may not hand back a borrow of its
// parameter ("borrows flow down, never up").
//
// Found 2026-09-06: the rule landed 2026-09-05 (610_007) and the next day
// orisha's `pump:raw` (`raw -> x.raw`) tripped it — blocking every Orisha
// build, native and the korulang.org wasm reactor alike, until `raw` became
// an owned arena copy. This pins the refusal on the minimal shape: returning
// `s.data` claims an owned string while handing back the caller's memory,
// which the owner could invalidate by discharge or mutation.
~tor sink { s: string }
~proc sink|zig {}
~tor borrow-back { s: string } -> string
~borrow-back -> s.data
~borrow-back(s: "hello"): r |> sink(s: r)
Actual compiler output
error[KORU095]: tor 'borrow-back' returns a borrow of its parameter 's' (`s.data`) — borrows flow down, never up; a `-> string` return must own what it carries
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_032_reject_borrow_return_of_param/input.kz:16:0
|
16 |
| ^
hint: copy it into an owned String and return the handle (*String<view!>), or take the handle at the consumer instead of reading (610_007)Frontend must reject with:
CONTAINS error[KORU095
CONTAINS borrows flow down, never upFlows
flow ~borrow-back click a branch to expand · @labels scroll to their anchor
borrow-back (s: "hello")
Test Configuration
MUST_ERROR