Files
ww/test/wcc/data/r926_sret_reject_struct_field/case.ww
Hojun-Cho d456263f7e test/wcc/data: grow the declarative compiler corpus to 1,224 fixtures
The r-prefixed waves absorb the runtime, reject, and byte-compare rows
of the migrated native carriers; each fixture is one directory with one
case.ww and a //ww:error, //ww:compile, //ww:run, or //ww:run-exit
directive covering both frontends.
2026-08-07 23:21:04 +09:00

18 lines
621 B
Plaintext

//ww:error "#40: sret-class call result cannot be cursor-widened into a tagged slot (mem-to-mem widen unwired)"
package main;
type oops = !str;
type nomem = !void;
type wide = struct { xs: []u8, ys: []u8, n: i64 };
type holder = struct { r: (wide | oops | nomem), k: i64 };
fn mk(b: []u8) (wide | oops | nomem) = { return wide { xs = b, ys = b, n = 1 }; };
export fn main() i32 = {
let buf: [4]u8 = [1u8, 2u8, 3u8, 4u8];
let h: holder = holder { r = mk(buf[0:4]), k = 5 };
match (h.r) {
case let w: wide => { if (w.n != 1) { return 1; }; };
case let e: oops => return 13;
case nomem => return 14;
};
return 0;
};