test: migrate Fam10 alias value tests to @test, carve divergences to pins (#5-C3)
fold-2 chunk C3 (drew's Fam8-13 plan): 8 alias value-row C drivers, 205 rows
re-homed with zero loss -- 177 value -> 8 test/lang/alias_*_test.ww @test
row-tables; 16 reject -> runww //ww:error carriers (both stages reject);
3 cs!=ww value rows -> 2 *_runonly_test.ww (T1, byte-id-excluded, #60/#81);
9 irreducible asymmetric rows -> slim C pins, each ticket-cited and
mutation-proven non-vacuous:
- accept amplen1/2,ampcap2: cs runs / ww rejects 'unsupported address-of
shape' (#96)
- cgen_b5 g73_heapfill: cs!=ww .s + ww link-fails on self-contained alloc;
compile-smoke pin (#24)
- cgen_b6 fsarg2_bound: both reject, different msgs, each vs the correct
stage (#271/#165 cs vs #272/#276/#277 ww)
- emit_b7 slc/slcstr/slctag _2lvl + slc_plain_ctl: slice-literal static-init
divergence (#120/#29-kin, ken-d2-oracle)
4 fully-migrated drivers deleted, 4 slimmed-in-place to hold only the
irreducible pins. LANGBYTEID floor 74->82 (8 new byte-id @test files); test
count 388->384 (4 deleted; 4 slimmed kept). do-not-auto-batch files not in
Fam10.
This commit is contained in:
55
test/lang/alias_structlit_init_test.ww
Normal file
55
test/lang/alias_structlit_init_test.ww
Normal file
@@ -0,0 +1,55 @@
|
||||
// alias_structlit_init_test — #63: let-init from an alias-NAMED struct
|
||||
// LITERAL, migrated from test/wcc/944_alias_structlit_init_run.c (#5-C3).
|
||||
// wwstage's cglet N_STRUCTLIT arm resolved the struct by a BARE
|
||||
// structlookup(sname): for an alias `type rep2 = rep` only the base `rep` is
|
||||
// registered, so the lookup returned nil and the field-fill never fired —
|
||||
// <=8B silently zeroed the slot and DROPPED the literal, >8B loud-bailed.
|
||||
// The fix routes the arm through structlookupchain (the #92/W2 SSoT), which
|
||||
// chases the alias chain to the base struct; cstage was always correct via
|
||||
// type_chase_named, so this is ww-only align-UP. The >24B sret RETURN twin
|
||||
// (cgenstmt:1250) had no scalar-default catch and was silently wrong —
|
||||
// reviewer-63 routed it through structlookupchain too (sret_return_alias32).
|
||||
//
|
||||
// The C driver ran each row on both stages + asserted cs==ww exit; here the
|
||||
// cstage run is test-lang (T1) and the byte-id is test-lang-byteid (T2).
|
||||
|
||||
package alias_structlit_init_test;
|
||||
|
||||
type rep = struct { id: size };
|
||||
type rep2 = rep;
|
||||
type st = struct { a: size, b: size };
|
||||
type row = st;
|
||||
type pt2 = struct { a: size, b: size };
|
||||
type big = struct { a: size, b: size, c: size, d: size };
|
||||
type biga = big;
|
||||
|
||||
fn mk() biga = { return biga{a=1, b=2, c=3, d=4}; };
|
||||
|
||||
@test fn letinit_typed() void = {
|
||||
let r: rep2 = rep2{id=6};
|
||||
assert(r.id: int == 6);
|
||||
};
|
||||
|
||||
@test fn letinit_untyped() void = {
|
||||
let r = rep2{id=6};
|
||||
assert(r.id: int == 6);
|
||||
};
|
||||
|
||||
@test fn letlit_alias16() void = {
|
||||
let a: row = row{a=3, b=4};
|
||||
assert((a.a + a.b): int == 7);
|
||||
};
|
||||
|
||||
// control: non-alias 16B let-init — the no-regress guard (the alias hop is
|
||||
// the trigger).
|
||||
@test fn control_direct() void = {
|
||||
let x: pt2 = pt2{a=3, b=4};
|
||||
assert((x.a + x.b): int == 7);
|
||||
};
|
||||
|
||||
// the >24B sret-RETURN twin of the let-init site (cgenstmt:1250): the alias
|
||||
// field-fill was SKIPPED and the callee returned an uninitialised sret buffer.
|
||||
@test fn sret_return_alias32() void = {
|
||||
let r: biga = mk();
|
||||
assert((r.a + r.b + r.c + r.d): int == 10);
|
||||
};
|
||||
Reference in New Issue
Block a user