Files
ww/test/lang/tuple_lit_declblind_test.ww
Hojun-Cho 07b3c74ab0 test: migrate Fam8 tuple value tests to @test + reject carriers (#5-C2)
fold-2 chunk C2 (drew's Fam8-13 plan): 14 tuple value-row C drivers migrate to
15 test/lang/*_test.ww @test row-tables (the +1 is 954_tuprecv, slimmed not
deleted -- its value rows split out while the asserttyped-stamp dimension stays
as a carrier-split C pin, mutation-proven non-vacuous). Reject rows move to 32
test/wcc/data/*/case.ww //ww:error carriers (runww asserts the substring in
BOTH stages). The test-lang byte-id (LANGBYTEID) gate gives cs==ww automatically
and is strictly more sensitive than re-running the wwstage leg; floor 59->74.
Tuple surfaced zero cs!=ww as the plan predicted -- no value-only carve. The 945
trio folds in here; 940_global_sret / 940_str_forrange / 926_tagscr untouched
(routed to drew per-file). Test count 402->388 = the 14 retired drivers.
2026-06-24 01:44:13 +09:00

66 lines
2.0 KiB
Plaintext

// tuple_lit_declblind_test — #64 + #68: a tuple LITERAL fills the register
// cursor DECL-BLIND. The #57 decl wire (a declared-tagged element's concrete
// rvalue widens into its box) stopped at N_LET / N_RETURN; the other two
// tuple-literal consumers — destructure-REASSIGN (N_MASSIGN, #64) and CALL-ARG
// send (#68) — rode the decl-less route, so a declared-tagged element was
// stored/sent WORD-0 ONLY (the box tag never set) and the cursor skewed every
// later element. Both stages, #263 gate-blind: the asm was byte-identical
// cs==ww and both ran wrong, so only RUNTIME catches it.
//
// Migrated from test/wcc/945_tuple_lit_declblind_run.c. Each value row reads
// the box PAYLOAD back (binds n and asserts its VALUE), not merely which match
// arm fired — a skew that sets the tag right but corrupts the payload still
// fails. The never-taken arms abort via assert(false), the migrated-test idiom
// for a diverging arm (the C original's non-`want` exit codes). The reject row
// (nested_tuple_arg) carries to test/wcc/data/tldb_nested_tuple_arg/. cstage
// run is test-lang; cs==ww byte-id is test-lang-byteid (T2) — both dimensions
// survive.
package tuple_lit_declblind_test;
type ev = (i32 | i64);
fn f(t: (ev, i64)) i32 = {
match (t.0) {
case let n: i64 => { if (n == 7) { return 1; }; return 3; };
case let m: i32 => { return 0; };
};
return 2;
};
fn g(t: (ev, i64)) i32 = {
let bp: i64 = 0;
match (t.0) {
case let n: i64 => { bp = n; };
case let m: i32 => { bp = 0; };
};
return (bp + t.1): i32;
};
@test fn massign_tagged() void = {
let a: ev = 5i32;
let b: i64 = 0;
a, b = (7i64, 99);
match (a) {
case let n: i64 => { assert(n == 7); };
case let m: i32 => { assert(false); };
};
};
@test fn callarg_tagged() void = {
assert(f((7i64, 99)) == 1);
};
@test fn massign_blank() void = {
let a: ev = 5i32;
_, a = (99, 7i64);
match (a) {
case let n: i64 => { assert(n == 7); };
case let m: i32 => { assert(false); };
};
};
@test fn callarg_drain() void = {
assert(g((7i64, 35)) == 42);
};