// mixed_scalar_tuple_sret_test — project #240: an over-cap tuple whose elements // mix a scalar with slices/str (e.g. `(int, []u8, str)`) must lay out // identically in both stages and round-trip through an sret return. Migrated // from test/wcc/940_mixed_scalar_tuple_sret_run.c. Two silent, gate-blind // cs!=ww divergences: callee SEND packed a leading scalar at the literal's // (untyped-int, size 0) stride so trailing elements packed 8 bytes low; caller // RECEIVE had no capacity gate so a 56B over-cap tuple was received via // registers instead of the sret dest. The @test fns pin the runtime element // values; T2 byte-id keeps cs==ww (rule 10). Each row covers an annotated and // an inferred receive and a distinct scalar position. package mixed_scalar_tuple_sret_test; fn mk_int_slice_str() (int, []u8, str) = { let b: []u8; b.len = 5; b.cap = 9; let s: str = "abcd"; return (42, b, s); }; fn mk_int_slice_str_inferred() (int, []u8, str) = { let b: []u8; b.len = 6; b.cap = 8; let s: str = "xyz"; return (17, b, s); }; fn mk_slice_str_int() ([]u8, str, int) = { let b: []u8; b.len = 7; b.cap = 9; let s: str = "hello"; return (b, s, 99); }; fn mk_str_int_slice() (str, int, []u8) = { let s: str = "abcde"; let b: []u8; b.len = 3; b.cap = 4; return (s, 77, b); }; @test fn int_slice_str() void = { let t: (int, []u8, str) = mk_int_slice_str(); assert(!(t.0 != 42)); assert(!(len(t.1) != 5)); assert(!(len(t.2) != 4)); }; @test fn int_slice_str_inferred() void = { let t = mk_int_slice_str_inferred(); assert(!(t.0 != 17)); assert(!(len(t.1) != 6)); assert(!(len(t.2) != 3)); }; @test fn slice_str_int() void = { let t: ([]u8, str, int) = mk_slice_str_int(); assert(!(len(t.0) != 7)); assert(!(len(t.1) != 5)); assert(!(t.2 != 99)); }; @test fn str_int_slice() void = { let t: (str, int, []u8) = mk_str_int_slice(); assert(!(len(t.0) != 5)); assert(!(t.1 != 77)); assert(!(len(t.2) != 3)); };