Files
ww/test/lang/tuprecv_test.ww
Hojun-Cho 83f5956df2 test: banner purge + WHY-only comment sweep (rule 8)
Every section banner dies (103 -> 0) across test/lang, the observer
suites, the C carriers, and the five comment-heavy corpus fixtures;
banner provenance (#N cites, carrier numbers, repair-cluster labels)
folded into headers or adjacent WHY comments. Narration deleted; row
provenance, ref cites, divergence pins, and layout contracts kept
(fwd-ref decl-order guards and bootstrap-gate corpus rationale
restored where the sweep over-cut). Comment-only proven: all 3742
wwbuild workdir .s byte-identical before/after; test-commit and
test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
2026-08-08 21:40:23 +09:00

75 lines
2.3 KiB
Plaintext

// 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);
};