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.
This commit is contained in:
2026-06-24 01:44:13 +09:00
parent 47c7dbc2c8
commit 07b3c74ab0
63 changed files with 3005 additions and 6577 deletions

View File

@@ -0,0 +1,11 @@
//ww:error "#234-tail"
package main;
fn wide() ([]u8, []u8) = {
let a: []u8; a.len = 1; let b: []u8; b.len = 2;
return (a, b);
};
export fn main() i32 = {
let a: [2][2]([]u8, []u8);
a[0][1] = wide();
return 0;
};

View File

@@ -0,0 +1,12 @@
//ww:error "#234-tail"
package main;
fn wide() ([]u8, []u8) = {
let a: []u8; a.len = 1; let b: []u8; b.len = 2;
return (a, b);
};
type S = struct { f: ([]u8, []u8) };
let g: S;
export fn main() i32 = {
g.f = wide();
return 0;
};

View File

@@ -0,0 +1,12 @@
//ww:error "#234-tail"
package main;
fn wide() ([]u8, []u8) = {
let a: []u8; a.len = 1; let b: []u8; b.len = 2;
return (a, b);
};
type S = struct { arr: [2]([]u8, []u8) };
export fn main() i32 = {
let s: S;
s.arr[1] = wide();
return 0;
};

View File

@@ -0,0 +1,12 @@
//ww:error "#234-tail"
package main;
fn wide() ([]u8, []u8) = {
let a: []u8; a.len = 1; let b: []u8; b.len = 2;
return (a, b);
};
fn ix() int = { return 0; };
export fn main() i32 = {
let arr: [2]([]u8, []u8);
arr[ix()] = wide();
return 0;
};

View File

@@ -0,0 +1,13 @@
//ww:error "#234-tail"
package main;
fn wide() ([]u8, []u8) = {
let a: []u8; a.len = 1; let b: []u8; b.len = 2;
return (a, b);
};
type S = struct { f: ([]u8, []u8) };
export fn main() i32 = {
let s: S;
let p: *S = &s;
p.f = wide();
return 0;
};

View File

@@ -0,0 +1,15 @@
//ww:error "tuple element must be a scalar, str, slice, or tagged-union"
// Lifted from test/wcc/945_tuple_lit_declblind_run.c reject row
// "nested_tuple_arg" (#64/#68/rule-7): a NESTED-TUPLE tuple-arg element has
// no transport and stays rule-7 LOUD. The #64/#68 fix graduates ONLY a
// declared-tagged element; the TY_TUPLE/STRUCT/ARRAY arms are preserved, so a
// future widen-everything regression re-breaks this. The substring is the
// shared diagnostic body, byte-identical on both stages (no file:line, no
// cstage "ww: " prefix).
package main;
fn h(t: ((i32, i32), i64)) i32 = {
return 0;
};
export fn main() i32 = {
return h(((1, 2), 3));
};

View File

@@ -0,0 +1,10 @@
//ww:error "over-cap tuple initialiser from a non-call source unwired"
package main;
fn pr() ((void | size), (void | size), size) = {
let t: ((void | size), (void | size), size) = (void, void, 1);
return t;
};
export fn main() i32 = {
let t = pr();
return t.2: i32;
};

View File

@@ -0,0 +1,11 @@
//ww:error "#22b: tagged element in an over-cap (sret) tuple return from a non-ident or widening source unwired"
package main;
fn g() (void | size) = { return 5: size; };
fn pr() ((void | size), (void | size), size) = {
let mx: (void | size) = 2: size;
return (g(), mx, 7);
};
export fn main() i32 = {
let t = pr();
return t.2: i32;
};

View File

@@ -0,0 +1,10 @@
//ww:error "#22b: tagged element in an over-cap (sret) tuple return from a non-ident or widening source unwired"
package main;
fn pr() ((void | size), (void | size), size) = {
let mx: (void | size) = 5: size;
return (1: size, mx, 9);
};
export fn main() i32 = {
let t = pr();
return t.2: i32;
};

View File

@@ -0,0 +1,8 @@
//ww:error "element kind unsupported"
package main;
export fn main() i32 = {
let s: [](u32, u32) = [];
append(s, (1, 2));
if (len(s) != 1) { return 1; };
return 0;
};

View File

@@ -0,0 +1,9 @@
//ww:error "tagged cast source shape unwired"
package main;
type un3 = (void | size | str);
type un4 = (void | size | str | *u8);
export fn main() i32 = {
let w: un4 = (5: size): un3;
if (!(w is size)) { return 1; };
return 0;
};

View File

@@ -0,0 +1,15 @@
//ww:error "on a global tagged ident unwired"
package main;
type err = !void;
let g: (size | err) = 7: size;
fn use() (size | err) = {
let x = g?;
return x: size;
};
export fn main() i32 = {
match (use()) {
case let s: size => { if (s != 7) { return 1; }; };
case err => { return 2; };
};
return 0;
};

View File

@@ -0,0 +1,8 @@
//ww:error "tuple arg element kind unsupported"
package main;
fn send(t: ((void | size), size)) size = { return t.1; };
export fn main() i32 = {
let mn: (void | size) = 5: size;
let t: ((void | size), size) = (mn, 4);
return send(t): i32;
};

View File

@@ -0,0 +1,8 @@
//ww:error "unsupported assign target shape"
package main;
export fn main() i32 = {
let mn: (void | size) = 5: size;
let t: ((void | size), size) = (mn, 4);
t.1 = 9;
return t.1: i32;
};

View File

@@ -0,0 +1,4 @@
//ww:error "unsupported element init (int/str literals only; rule 7)"
package main;
let g: ((void | size), i64) = (5, 4);
export fn main() i32 = { return g.1: i32; };

View File

@@ -0,0 +1,8 @@
//ww:error "tagged tuple element from a non-local source shape unwired"
package main;
fn g() (void | size) = { return 5: size; };
fn mk() ((void | size), size) = { return (g(), 4); };
export fn main() i32 = {
let t = mk();
return t.1: i32;
};

View File

@@ -0,0 +1,7 @@
//ww:error "tuple literal exceeds register-return ABI capacity"
package main;
export fn main() i32 = {
let t: (str, str) = ("ab", "cde");
if (t.0.len != 2) { return 1; };
return 0;
};

View File

@@ -0,0 +1,8 @@
//ww:error "tuple literal exceeds register-return ABI capacity"
package main;
export fn main() i32 = {
let e: (void | u32 | str) = "abc";
let t: (u64, (void | u32 | str)) = (7u64, e);
if (t.0 != 7u64) { return 1; };
return 0;
};

View File

@@ -0,0 +1,12 @@
//ww:error "tuple arg from unsupported source shape"
package main;
type holder = struct { t: (i64, i64) };
fn sum(t: (i64, i64)) i64 = {
return t.0 + t.1;
};
export fn main() i32 = {
let tt: (i64, i64) = (1, 2);
let h: holder = holder{ t = tt };
if (sum(h.t) != 3) { return 1; };
return 0;
};

View File

@@ -0,0 +1,11 @@
//ww:error "tuple element must be a scalar"
package main;
fn f(t: ((i64, i64), i64)) i64 = {
return t.1;
};
export fn main() i32 = {
let inner: (i64, i64) = (1, 2);
let t: ((i64, i64), i64) = (inner, 9);
if (f(t) != 9) { return 1; };
return 0;
};

View File

@@ -0,0 +1,13 @@
//ww:error "tuple ident exceeds register-return ABI capacity"
package main;
fn f(t: (str, str)) i64 = {
return (len(t.0) + len(t.1)): i64;
};
fn g() (str, str) = {
return ("ab", "cde");
};
export fn main() i32 = {
let t: (str, str) = g();
if (f(t) != 5) { return 1; };
return 0;
};

View File

@@ -0,0 +1,7 @@
//ww:error "unsupported element init (int/str literals only; rule 7)"
package main;
let g: (f64, i64) = (2.5, 4);
export fn main() i32 = {
if (g.1 != 4) { return 1; };
return 0;
};

View File

@@ -0,0 +1,7 @@
//ww:error "unsupported assign target shape"
package main;
let g: (i64, i64) = (3, 4);
export fn main() i32 = {
g.0 = 7;
return 0;
};

View File

@@ -0,0 +1,8 @@
//ww:error "global tuple as a first-class value unwired"
package main;
let g: (i64, i64) = (3, 4);
export fn main() i32 = {
let q: (i64, i64) = g;
if (q.0 != 3) { return 1; };
return 0;
};

View File

@@ -0,0 +1,7 @@
//ww:error "tuple element must be a scalar"
package main;
export fn main() i32 = {
let t = ((4, 2), 36);
if (t.1 != 36) { return 1; };
return 0;
};

View File

@@ -0,0 +1,11 @@
//ww:error "tagged tuple element from a non-local source shape unwired"
package main;
type un16 = (void | size);
fn mke() un16 = {
return 5: size;
};
export fn main() i32 = {
let t: (un16, size) = (mke(), 9);
if (t.1 != 9) { return 1; };
return 0;
};

View File

@@ -0,0 +1,11 @@
//ww:error "tagged element in an over-cap (sret) tuple return"
package main;
type un = (void | size);
fn mk() (un, un, size, size) = {
return (5: size, void, 8, 9);
};
export fn main() i32 = {
let t = mk();
if (t.2 != 8) { return 1; };
return 0;
};

View File

@@ -0,0 +1,14 @@
//ww:error "widening into a wider declared union slot needs a tag remap"
package main;
type st16 = struct { a: size, b: size };
type small = (void | u8);
type big = (void | u8 | st16);
fn mk() (big, size) = {
let s: small = 5u8;
return (s, 9);
};
export fn main() i32 = {
let t = mk();
if (t.1 != 9) { return 1; };
return 0;
};

View File

@@ -0,0 +1,9 @@
//ww:error "for-range over a module-global"
package main;
fn fa(c: rune) bool = { return c == 'a'; };
const tbl: [](str, *fn(c: rune) bool) = [("ab", &fa), ("cdef", &fa)];
export fn main() i32 = {
let n: int = 0;
for (let e .. tbl) { n += 1; };
return n: i32;
};

View File

@@ -0,0 +1,9 @@
//ww:error "tuple param element overflows integer arg regs (DI/SI/DX/CX/R8/R9); stitch out of scope, see #163"
package main;
fn pair(a: i64, b: i64) (i64, i64) = { return (a, b); };
fn f(a: i64, b: i64, c: i64, d: i64, e: i64, t: (i64, i64)) i64 = {
return a + b + c + d + e + t.0 + t.1;
};
export fn main() i32 = {
return (f(1, 2, 3, 4, 5, pair(6, 7)): i32);
};

View File

@@ -0,0 +1,4 @@
//ww:error "variant tag unresolved (untyped/literal tuple element"
package main;
fn f(x: u64) ((bool, u64) | void) = { return (true, x); };
export fn main() i32 = { return 0; };

View File

@@ -0,0 +1,12 @@
//ww:error "tuple-in-union variant tag unresolved"
package main;
fn mk() ((i64, i64) | nomem) = {
return (5, 6);
};
export fn main() i32 = {
match (mk()) {
case let t: (i64, i64) => { if (t.0 != 5) { return 1; }; };
case => return 2;
};
return 0;
};