Files
ww/test/lang/tuprecv_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

75 lines
2.4 KiB
Plaintext

// tuprecv_test — runtime + byte-id net for #102: the 16B whole-tuple-from-call
// receive (`let t = mk()`, then field reads t.0 / t.1). Migrated from
// test/wcc/954_tuprecv_run.c.
//
// Root: wwstage's cglet had NO 16B tuple-from-call receive branch, so a
// `let t = call()` whose callee returns a 2-eightbyte (16B) tuple fell through
// to the generic single-word store and never spilled word1 (the DX eightbyte)
// — silent loss of t.1. cstage has the branch (cmd/w6c/cgen.c:6652). The fix
// mirrors it in cglet. The all-integer (i64,i64) receive dropped DX too, so
// that "control" row is ALSO a fix row, not a pure no-op. The destructure form
// `let (a,b) = mk()` (cgmlet + tupstore cursor) was already byte-id; the
// wide/str-element 32B and the struct{i64,i64} 16B receives are over-catch
// guards (the sz==16 + rettupleof!=nil gate must not hijack them).
//
// The C driver ran each row on both stages + asserted cs==ww .s byte-id; here
// the cstage run is test-lang (T1) and the byte-id is test-lang-byteid (T2), so
// both dimensions survive.
//
// NOTE: the #121 asserttyped sub-dimension of ctl_destr (the C driver asserted
// w6c_ww emits NO `asserttyped:` diagnostic on the float destructure binding,
// the #121 A-narrow stamp net) is NOT carried by test-lang (no stderr grep);
// flagged to advisor drew, not silently dropped.
package tuprecv_test;
fn mk_f64_i64() (f64, i64) = { return (2.5, 7); };
fn mk_i64_f64() (i64, f64) = { return (7, 2.5); };
fn mk_i64_i64() (i64, i64) = { return (5, 7); };
fn mk_ctl_destr() (f64, i64) = { return (2.5, 7); };
fn mk_ctl_str() (i64, str) = { return (7, "hi"); };
type pair = struct { a: i64, b: i64 };
fn mk_ctl_struct() pair = { return pair { a = 5, b = 7 }; };
@test fn f64_i64() void = {
let t = mk_f64_i64();
let f: f64 = t.0;
let i: i64 = t.1;
assert((f: i32) + (i: i32) == 9);
};
@test fn i64_f64() void = {
let t = mk_i64_f64();
let i: i64 = t.0;
let f: f64 = t.1;
assert((i: i32) + (f: i32) == 9);
};
@test fn i64_i64() void = {
let t = mk_i64_i64();
let a: i64 = t.0;
let b: i64 = t.1;
assert((a: i32) + (b: i32) == 12);
};
@test fn ctl_destr() void = {
let (f, i) = mk_ctl_destr();
assert((f: i32) + (i: i32) == 9);
};
@test fn ctl_str() void = {
let t: (i64, str) = mk_ctl_str();
assert(t.0: i32 == 7);
};
@test fn ctl_struct() void = {
let t = mk_ctl_struct();
assert((t.a: i32) + (t.b: i32) == 12);
};