Files
ww/test/lang/match_nonident_idx_test.ww
Hojun-Cho 246e5bb90e test: migrate Fam9 match/tagged value tests to @test (#5-C5)
fold-2 chunk C5 (drew's Fam8-13 plan), the highest-risk chunk: 21 match/tagged
value-row C drivers re-homed. 20 -> test/lang/*_test.ww @test row-tables + 12
runww //ww:error carriers (both stages reject). The global-tag cluster
(globtag*/globstructwiden/taggedderefstore/...), which sits on the #15/#17
global-ptr fix, was empirically probed byte-id CLEAN -- the predicted hotspot
surfaced ZERO fresh cs!=ww. Carves: variant_chain_b95 #81 -> _runonly (genuinely
diverges at HEAD); callret_bound277 #277 -> slim C pin (cs-runs/ww-rejects),
mutation-gated. 929_tagged_memarg kept whole (SSE-ABI asm conformance). 19
drivers deleted, 944_variant_chain slimmed to the #277 pin.

The match-on-tagged-struct-field divergence (former #26) probed RESOLVED for all
its cited shapes (938 voidstr_field/recursion_torture, tagnorm dedup_match all
byte-id cs==ww + value-correct) -- closed no-reproducer-at-HEAD, attribution to
#15/#17 INFERRED. Those rows migrate as normal byte-id @test and serve as the
REGRESSION SENTINEL for the inferred close (a resurgence trips the gate).

LANGBYTEID floor 93->113; test count 374->355 (19 deleted; 929 + 944_variant_chain
kept). do-not-auto-batch (926_tagscr/940_global_sret/940_str_forrange) untouched.
2026-06-24 20:42:08 +09:00

103 lines
2.5 KiB
Plaintext

// match_nonident_idx_test — match on an N_INDEX scrutinee whose base is a
// non-ident (struct-field slice, chained-dot slice, 56B-slot regex-inst union),
// plus ident/ident-base controls. Pins arm-order independence and the stamped-
// carrier resolve at any base depth. Migrated from
// test/wcc/928_match_nonident_idx_run.c (value rows; C driver asserted cs==ww .s).
package match_nonident_idx_test;
type va = void;
type vb = bool;
type vc = size;
type tu = (va | vb | vc);
type holder = struct { xs: []tu, n: size };
type inner = struct { xs: []tu, k: size };
type outer = struct { in_: inner, n: size };
type big = struct { a: i64, b: i64, c: i64, d: i64, e: i64, f: i64 };
type ilit = struct { r: i64 };
type imatch = void;
type inst = (big | ilit | imatch);
type re = struct { insts: []inst, n: i64 };
@test fn field_slice_idx() void = {
let sl: []tu = [(true: vb), ((7: size): vc)];
let h: holder;
h.xs = sl;
h.n = 2;
match (h.xs[0]) {
case let b: vb => { assert(b: bool); };
case => { assert(false); };
};
match (h.xs[1]) {
case let s: vc => { assert((s: size) == 7); };
case => { assert(false); };
};
match (h.xs[0]) {
case va => { assert(false); };
case let b: vb => { assert(b: bool); };
case vc => { assert(false); };
};
};
@test fn regex_inst_56b() void = {
let sl: []inst;
let l: ilit = ilit { r = 65 };
let v: inst = l;
append(sl, v);
let m: inst = void: imatch;
append(sl, m);
let r: re;
r.insts = sl;
r.n = 2;
match (r.insts[0]) {
case let x: ilit => { assert(x.r == 65); };
case => { assert(false); };
};
match (r.insts[1]) {
case imatch => { };
case => { assert(false); };
};
match (r.insts[0]) {
case big => { assert(false); };
case let x: ilit => { assert(x.r == 65); };
case imatch => { assert(false); };
};
};
@test fn dot_depth_idx() void = {
let sl: []tu = [(true: vb), ((9: size): vc)];
let o: outer;
o.in_.xs = sl;
o.in_.k = 1;
o.n = 2;
match (o.in_.xs[0]) {
case let b: vb => { assert(b: bool); };
case => { assert(false); };
};
match (o.in_.xs[1]) {
case va => { assert(false); };
case let s: vc => { assert((s: size) == 9); };
case vb => { assert(false); };
};
};
@test fn ident_and_identbase_controls() void = {
let v: tu = (true: vb);
match (v) {
case let b: vb => { assert(b: bool); };
case => { assert(false); };
};
let arr: [2]tu = [(true: vb), ((7: size): vc)];
match (arr[1]) {
case let s: vc => { assert((s: size) == 7); };
case => { assert(false); };
};
let sl: []tu = [(true: vb), ((7: size): vc)];
match (sl[0]) {
case let b: vb => { assert(b: bool); };
case => { assert(false); };
};
};