//ww:run-exit 0 // #34 close: append() accepts a struct CALL rvalue element — GP // register-class receive (24B str+i32), odd sub-8 (3B), and sized // tail (4B) shapes, evaluated pre-grow into a per-site scratch. package main; type gp24 = struct { name: str, id: i32 }; type odd3 = struct { a: u8, b: u8, c: u8 }; type tail4 = struct { v: i32 }; fn mkgp(id: i32) gp24 = { let e: gp24; e.name = "x"; e.id = id; return e; }; fn mkodd() odd3 = { let e: odd3; e.a = 1u8; e.b = 2u8; e.c = 3u8; return e; }; fn mktail() tail4 = { let e: tail4; e.v = 5; return e; }; fn main() i32 = { let gs: []gp24 = []; append(gs, mkgp(7)); append(gs, mkgp(9)); if (gs.len != 2 || gs[0].id != 7 || gs[1].id != 9) { return 1; }; if (gs[0].name.len != 1) { return 2; }; let os_: []odd3 = []; append(os_, mkodd()); if (os_[0].a != 1u8 || os_[0].c != 3u8) { return 3; }; let ts: []tail4 = []; append(ts, mktail()); if (ts[0].v != 5) { return 4; }; return 0; };