Rename warnings: a macro argument the macro carries to the declaration is said wherever it is written (review H-1/H-2)

The home-set scoping dropped a bare macro argument outside the home set
whatever the macro did with it, and never saw a `bind` produced by a macro —
silent missed renames, regressions against 0.59.0 (`CONN(state_q)` building
`.state_q(state_q)` broke the instantiation without a word). New
rename/carry.rs decides per macro and formal position whether an argument is
carried: after a `.` (past blanks and pastes), into a carried position of
another macro, or by a macro that expands to a `bind` into the unit (every
position; its body is news and a file invoking it is home). An undefined
macro's arguments, one past the formals and a macro cycle are doubt and said.

Tests: tests/rename_macro_carry.rs (8), carry.rs unit tests (4). Workspace
lib/bins/tests: 80 suites, 5 076 passed, 0 failed, 51 ignored (guard exit 0).
OpenTitan engine probe against carrying disabled: state_q 47 = 47,
StIdle 0 = 0, cnt_q 13 = 13 warnings, timing unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
lucioandClaude Opus 5.5 committed 2026-10-07 01:01:41 -07:00
1 parent 7794d3938b
commit e8e22c2364
8 files changed
+580 -37

No files matched your search

@@ -525,6 +525,32 @@ run was **cut by the guard** at 1 700 s while starting
stall); the one re-run: 78 suites, 5 059 passed, 0 failed, 51 ignored;
doc-tests 6 suites, 1 passed; corpus 814/820.
**2026-10-06 — fix for the independent review's H-1/H-2 (`oct_review.md`).**
A bare macro argument outside the home set was dropped whatever the macro
did with it, and a `bind` produced by a macro was invisible to K2/H3 — both
silent missed renames, regressions against 0.59.0 (`.x(x)` built by
`` `CONN(state_q)`` broke the instantiation without a word). New
`vlog_refactor/src/rename/carry.rs` decides, per macro and formal position,
whether an argument is *carried*: the body spells the formal after a `.`
(past blanks and `` `` `` pastes), passes it to a carried position of another
macro, or the macro expands to a `bind` into the declaring unit (a
*binder*, directly or through a macro its body invokes; every position
carried). A carried bare argument is news wherever it is written; so is an
argument of a macro the set does not define, one past the formals, and one
in a macro cycle (doubt). A binder's body is news (`keeps_define_body`) and
a file invoking a binder is home (K2). `scoped::spellings` now also sees a
`.` through a paste (`` u_m.``state_q``), which only adds warnings.
Assumption: a `bind` is recognised only where `bind` is spelled in a
`` `define`` body of the set; an undefined macro's arguments are carried, but
the macro is not taken to expand to a `bind`. Tests:
`vlog_refactor/tests/rename_macro_carry.rs` (8: PC, PA, PA2, a passed-on
position and a non-carried one, PD body and argument, an undefined macro,
and a plain-expression macro that stays silent) and 4 unit tests in
`carry.rs`. OpenTitan (engine probe, whole `hw`, against the same tree with
carrying disabled): `entropy_src_main_sm.state_q` 47 = 47 warnings,
`hmac_core.StIdle` 0 = 0, `prim_count.cnt_q` 13 = 13, timing unchanged (~2.9 s)
— no noise added there.
## QA log
**2026-09-30 — QA agent (Opus).** Verdict: **PASS with findings** — no