From 6c70b46d5f915832916605e0dfc54b9bf3068241 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 21 May 2026 22:37:27 +0900 Subject: [PATCH] selfhost/cmd/wcc: checkfile pass-2 walks d.attr (A.6.2.1-pre) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `@symbol("rt_abort")` and similar attr arg literals (N_STRLIT inside N_ATTR.list) never reach the post-order exprtype dispatch because the top-level dispatch in checkfile pass-2 only enters per-decl via d.lhs and d.body — d.attr was an oversight. Add a one-line resolvewalk descent before the kind dispatch, mirroring resolvewalk L405 which already descends n.attr on inner nodes. Discovered while landing the A.6.2.1 assertion: the unstamped N_STRLIT inside `@symbol("...")` would trip the assertion on every selfhost source (lib/os pulls these in transitively). Fix lands as its own prep commit so the next session can start clean on the A.6.2.1 main work (bail-discipline refactor per Drew's 5-lite, then δ+γ stamp completion). A.6.2 status: 0a-g landed; 0b-pre N_TPARAM landed; assertion enable (A.6.2.1e) deferred behind 5-lite + per-bail closure work — see PLAN.md and tasks #20-#25. `make sizelint` clean. `make test-unit` green; full `make test` batched per option B (next session). --- selfhost/cmd/w6c/main.combined.ww | 6 ++++++ selfhost/cmd/wcc/check.ww | 6 ++++++ selfhost/cmd/wwdump/main.combined.ww | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index 7207319a..5cb26325 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -9671,6 +9671,12 @@ export fn checkfile(c: *checker, file: *node) void = { d = file.list; for (d != nil) { c.curmod = declmod(file, d); + // A.6.2.1-pre — attr-subtree gap: top-level dispatch below walks + // d.lhs / d.body per kind but never d.attr, leaving `@symbol("…")` + // arg literals (N_STRLIT) outside the post-order exprtype + // dispatch. Mirror resolvewalk L405 which descends n.attr on + // inner nodes. + if (d.attr != nil) { resolvewalk(c, d.attr); }; let k: nkind = d.kind; if (k == nkind.N_FNDECL) { if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type diff --git a/selfhost/cmd/wcc/check.ww b/selfhost/cmd/wcc/check.ww index 00221e72..118cf94d 100644 --- a/selfhost/cmd/wcc/check.ww +++ b/selfhost/cmd/wcc/check.ww @@ -2707,6 +2707,12 @@ export fn checkfile(c: *checker, file: *node) void = { d = file.list; for (d != nil) { c.curmod = declmod(file, d); + // A.6.2.1-pre — attr-subtree gap: top-level dispatch below walks + // d.lhs / d.body per kind but never d.attr, leaving `@symbol("…")` + // arg literals (N_STRLIT) outside the post-order exprtype + // dispatch. Mirror resolvewalk L405 which descends n.attr on + // inner nodes. + if (d.attr != nil) { resolvewalk(c, d.attr); }; let k: nkind = d.kind; if (k == nkind.N_FNDECL) { if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 6eb2071d..0ee89acf 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -9671,6 +9671,12 @@ export fn checkfile(c: *checker, file: *node) void = { d = file.list; for (d != nil) { c.curmod = declmod(file, d); + // A.6.2.1-pre — attr-subtree gap: top-level dispatch below walks + // d.lhs / d.body per kind but never d.attr, leaving `@symbol("…")` + // arg literals (N_STRLIT) outside the post-order exprtype + // dispatch. Mirror resolvewalk L405 which descends n.attr on + // inner nodes. + if (d.attr != nil) { resolvewalk(c, d.attr); }; let k: nkind = d.kind; if (k == nkind.N_FNDECL) { if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type