selfhost/cmd/wcc: checkfile pass-2 walks d.attr (A.6.2.1-pre)

`@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).
This commit is contained in:
2026-05-21 22:37:27 +09:00
parent 009c4b35e2
commit 6c70b46d5f
3 changed files with 18 additions and 0 deletions

View File

@@ -9671,6 +9671,12 @@ export fn checkfile(c: *checker, file: *node) void = {
d = file.list; d = file.list;
for (d != nil) { for (d != nil) {
c.curmod = declmod(file, d); 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; let k: nkind = d.kind;
if (k == nkind.N_FNDECL) { if (k == nkind.N_FNDECL) {
if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type

View File

@@ -2707,6 +2707,12 @@ export fn checkfile(c: *checker, file: *node) void = {
d = file.list; d = file.list;
for (d != nil) { for (d != nil) {
c.curmod = declmod(file, d); 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; let k: nkind = d.kind;
if (k == nkind.N_FNDECL) { if (k == nkind.N_FNDECL) {
if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type

View File

@@ -9671,6 +9671,12 @@ export fn checkfile(c: *checker, file: *node) void = {
d = file.list; d = file.list;
for (d != nil) { for (d != nil) {
c.curmod = declmod(file, d); 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; let k: nkind = d.kind;
if (k == nkind.N_FNDECL) { if (k == nkind.N_FNDECL) {
if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type if (d.lhs != nil) { resolvewalk(c, d.lhs); }; // return type