From afd62a9187590d530b1a5049c39ebbe2f1b9bd76 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 21 May 2026 21:14:08 +0900 Subject: [PATCH] selfhost/cmd/wcc: stamp e.type_ for N_SPREAD (A.6.2.0e) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port head-only of cstage cmd/wcc/check.c:1212-1213 to exprtype's new N_SPREAD arm. The spread expression `xs...` carries the operand's type — pass-through stamp, no structural synthesis. A.6.2 step 5 of 8 (γ order). The smallest stamp arm in the series; mirrors cstage's one-liner directly. `make test-unit` green; full `make test` batched per option B. --- selfhost/cmd/w6c/main.combined.ww | 7 +++++++ selfhost/cmd/wcc/check.ww | 7 +++++++ selfhost/cmd/wwdump/main.combined.ww | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index 678a94b2..b9295e3a 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -8890,6 +8890,13 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = { }; return nil; }; + if (k == nkind.N_SPREAD) { + // A.6.2.0e — pass-through stamp. Mirrors cstage check.c:1212-1213. + // The spread expression `xs...` carries the operand's type. + let t: *node = exprtype(c, e.lhs, nil); + if (t != nil) { e.type_ = tinfofornode(c, t): *void; }; + return t; + }; if (k == nkind.N_TRYPROP) { // success unwrap: the success-variant type of operand's // tagged union. diff --git a/selfhost/cmd/wcc/check.ww b/selfhost/cmd/wcc/check.ww index 1b19efe1..96a332c2 100644 --- a/selfhost/cmd/wcc/check.ww +++ b/selfhost/cmd/wcc/check.ww @@ -1926,6 +1926,13 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = { }; return nil; }; + if (k == nkind.N_SPREAD) { + // A.6.2.0e — pass-through stamp. Mirrors cstage check.c:1212-1213. + // The spread expression `xs...` carries the operand's type. + let t: *node = exprtype(c, e.lhs, nil); + if (t != nil) { e.type_ = tinfofornode(c, t): *void; }; + return t; + }; if (k == nkind.N_TRYPROP) { // success unwrap: the success-variant type of operand's // tagged union. diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 6352b51a..7554014f 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -8890,6 +8890,13 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = { }; return nil; }; + if (k == nkind.N_SPREAD) { + // A.6.2.0e — pass-through stamp. Mirrors cstage check.c:1212-1213. + // The spread expression `xs...` carries the operand's type. + let t: *node = exprtype(c, e.lhs, nil); + if (t != nil) { e.type_ = tinfofornode(c, t): *void; }; + return t; + }; if (k == nkind.N_TRYPROP) { // success unwrap: the success-variant type of operand's // tagged union.