Files
ww/test/lang/alias_emit_b7_test.ww
Hojun-Cho 3ee1906497 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.
2026-06-24 02:45:09 +09:00

96 lines
3.8 KiB
Plaintext

// alias_emit_b7_test — #5 alias arc B7 (finale): the cgen static-DATA emitter
// ELEM-type alias chases, migrated from test/wcc/944_alias_emit_b7_run.c
// (#5-C3). The residual single peel was on the ELEMENT type (u->sub), so a
// 2-level-elem-alias global missed the TY_STRUCT / TY_STR kind tests and fell
// off the foldable-literal path: cs emitted NO DATA (link-loud, or latent
// silence when unreferenced) while ww always emitted. The fix chases the elem
// type at each emitter site; cs aligns UP onto ww's already-correct emit and
// the rows graduate to byte-id. `type el = el0` over a named struct is ALREADY
// two NAMED layers, so the "_1lvl" spelling graduates with the 2-level rows;
// only a direct alias of a primitive is a true single layer. The C driver ran
// each row both stages + asserted cs==ww exit; here the cstage run is
// test-lang (T1) and byte-id is test-lang-byteid (T2). The slice-of-{str,
// slice,tagged} BUILDERR rows and ww-checker-reject slice cells live elsewhere.
package alias_emit_b7_test;
// sarr_2lvl: [2]el 2-lvl alias struct — elem alias missed TY_STRUCT.
type sarr2_el0 = struct { a: i64, b: i64 };
type sarr2_el1 = sarr2_el0;
type sarr2_el = sarr2_el1;
let g_sarr2: [2]sarr2_el = [sarr2_el0 { a = 1, b = 2 }, sarr2_el0 { a = 3, b = 4 }];
// sarr_1lvl: [2]el, el = el0 — two NAMED layers by construction.
type sarr1_el0 = struct { a: i64, b: i64 };
type sarr1_el = sarr1_el0;
let g_sarr1: [2]sarr1_el = [sarr1_el0 { a = 1, b = 2 }, sarr1_el0 { a = 3, b = 4 }];
// sarr_plain_ctl: [2]el0 control.
type sarrc_el0 = struct { a: i64, b: i64 };
let g_sarrc: [2]sarrc_el0 = [sarrc_el0 { a = 1, b = 2 }, sarrc_el0 { a = 3, b = 4 }];
// sarr_unref_2lvl: NEVER-REFERENCED 2-lvl-elem global — pre-B7 cs silently
// lacked DATA (no reference → no link error → latent silence). The byte-id vs
// ww (which always emitted) is the closure pin.
type sarru_el0 = struct { a: i64, b: i64 };
type sarru_el1 = sarru_el0;
type sarru_el = sarru_el1;
let g_sarru: [2]sarru_el = [sarru_el0 { a = 1, b = 2 }, sarru_el0 { a = 3, b = 4 }];
// strarr_2lvl: [2]ms 2-lvl alias str — eu != TY_STR → generic path can't fold
// strlits → link-loud. Also pins letpreintern's intern-order coupling.
type strarr2_ms0 = str;
type strarr2_ms = strarr2_ms0;
let g_strarr2: [2]strarr2_ms = ["aa", "bbb"];
// strarr_1lvl_ctl: type ms = str — TRUE 1-level; worked pre-B7, byte-neutral.
type strarr1_ms = str;
let g_strarr1: [2]strarr1_ms = ["aa", "bbb"];
// strarr_plain_ctl: [2]str control.
let g_strarrc: [2]str = ["aa", "bbb"];
// scalararr_2lvl: [3]my64b raw-bytes path — scalar fold never consulted eu,
// worked pre-B7, byte-neutral regression net.
type scalararr_my64 = i64;
type scalararr_my64b = scalararr_my64;
let g_scalararr: [3]scalararr_my64b = [5, 6, 7];
@test fn sarr_2lvl() void = {
assert(g_sarr2[0].a + g_sarr2[0].b + g_sarr2[1].a + g_sarr2[1].b == 10);
};
@test fn sarr_1lvl() void = {
assert(g_sarr1[0].a + g_sarr1[0].b + g_sarr1[1].a + g_sarr1[1].b == 10);
};
@test fn sarr_plain_ctl() void = {
assert(g_sarrc[0].a + g_sarrc[0].b + g_sarrc[1].a + g_sarrc[1].b == 10);
};
// zero-consumer latent-silence pin: the global is never read in the C source's
// main, so its DATA emit is asserted only by the byte-id (T2) gate; the T1 run
// merely exercises the def's presence.
@test fn sarr_unref_2lvl() void = {
assert(g_sarru[0].a + g_sarru[0].b + g_sarru[1].a + g_sarru[1].b == 10);
};
@test fn strarr_2lvl() void = {
assert(len(g_strarr2[0]) == 2);
assert(len(g_strarr2[1]) == 3);
};
@test fn strarr_1lvl_ctl() void = {
assert(len(g_strarr1[0]) == 2);
assert(len(g_strarr1[1]) == 3);
};
@test fn strarr_plain_ctl() void = {
assert(len(g_strarrc[0]) == 2);
assert(len(g_strarrc[1]) == 3);
};
@test fn scalararr_2lvl() void = {
assert(g_scalararr[0] + g_scalararr[1] + g_scalararr[2] == 18);
};