writeonce/compiler/test/golden/owner-err/borrow-escape.expected
shoney.arickathil 023233895c test(compiler): unit helpers run inference; retarget borrow-escape fixture
Wire Gcinfer.infer into runner.ml's owner_str/emit_str so the unit tests
classify GC-ness identically to the driver (prerequisite for removing @gc: its
tests read the golden .wo through the library).

That exposed owner-err/borrow-escape.wo, which tested WO-E304 on *class*
escapes — now legally demand-promoted. Retargeted it to CONTAINER (`multi Text`)
escapes, which are owned and never promoted, so it still exercises the three
WO-E304 shapes (stored-in-field, returned, moved-to-take). Assertion positions
+ golden re-blessed.

Verified: woc-test 566/0, test_diag 14/0, oop-e2e 79/0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 19:10:39 +02:00

20 lines
972 B
Text

owner-err/borrow-escape.wo:9:18: error WO-E304: borrow of `other` cannot be stored in `self.items` — borrows cannot outlive their scope
self.items = other
^
owner-err/borrow-escape.wo:8:12: `other` is borrowed here — declare it `take other: T` to pass ownership in
fn adopt(other: multi Text) {
^
owner-err/borrow-escape.wo:18:10: error WO-E304: borrow of `h.items` escapes `leak` — borrows cannot outlive their scope
return h.items
^
owner-err/borrow-escape.wo:17:9: `h` is borrowed here — declare it `take h: T` to pass ownership in
fn leak(h: Holder) -> multi Text {
^
owner-err/borrow-escape.wo:22:15: error WO-E304: borrow of `h.items` cannot be passed to `take b` — borrows cannot outlive their scope
return keep(h.items)
^
owner-err/borrow-escape.wo:21:10: `h` is borrowed here — declare it `take h: T` to pass ownership in
fn stash(h: Holder) -> Int {
^