Docs for §65.1 match the code (review M-3)
generate-label-rename README: "What changed" covers reworks 1-5 and the review fixes; the stale "engine and verifier unchanged in code" claim is replaced (what a rename rewrites is unchanged; the verifier gained no normalization, only path-qualified file names). Status lists reworks 2-5, P1/P2, §65.6 and the review; work log entries for M-2 and M-3, including that QA's P1/P2 were fixed in the tree with no log entry. refactor-rename README: dated correction. topo row 40: second half answered by row 43. CHANGELOG: the two scoping bullets merged into one that matches rework 5 plus the H-1/H-2 fix. qa_warning_scope.rs P1/P2 test comments and the rename module doc updated (comments only; that suite: 24 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6d1957076a
commit
a062f62581
7 files changed
+104
-35
No files matched your search
+25
-26
@@ -47,34 +47,33 @@ TODO §65.1, topo §2.9 row 43 (MCP-14). (`docs/features/generate-label-rename`.
|
||||
unresolved paths are found too.
|
||||
- **Rename warnings and mentions are about the renamed declaration.** For a
|
||||
member of a module or interface (a net, variable, port, parameter, block,
|
||||
…) a bare spelling of its name in a macro argument, a `` `define`` body, an
|
||||
…), a bare spelling of its name in a macro argument, a `` `define`` body, an
|
||||
unstructured assertion, a comment or a string is reported only where it can
|
||||
mean it — in the declaring module (after a scope lookup, for code), or in a
|
||||
file the rename edits (for comments and strings); a dotted spelling
|
||||
(`.state_q`, a possible hierarchical path) is still reported wherever it
|
||||
is. A module, interface, package or package member is reported everywhere
|
||||
as before. On opentitan the `state_q` rename's answer went from 274 lines
|
||||
(61 kB, 230 macro warnings, 229 about other modules) to 72 lines (12 kB),
|
||||
mean it: in the declaration's **home set** — the declaring file,
|
||||
everything it `` `include``s, whatever includes it (transitively), and the
|
||||
files the rename edits. In code, a spelling in the declaring file is
|
||||
reported after a scope lookup finds the declaration there (an instantiating
|
||||
module's own same-named signal is not); one in an included fragment always;
|
||||
a `` `define`` body when the macro is invoked from the home set (through
|
||||
other macros too — `ASSERT_DEFAULT_CLK`'s `clk_i`); a macro argument inside
|
||||
a `bind` into the declaring module; and a bare use in the plain code of an
|
||||
included fragment (`prim_util_memload.svh`'s `mem`) is named as a use the
|
||||
rename could not edit. Reported wherever they are written: a dotted
|
||||
spelling (`.state_q`, a possible hierarchical path); a bare macro argument
|
||||
the macro carries to the declaration — after a `.` (`` `CONN(state_q)``
|
||||
building `.state_q(state_q)`, `` `FORCE(state_q)`` building
|
||||
`force u_m.state_q`), into a `bind` into the declaring module, or into a
|
||||
macro lucisv has no definition of; and the body of a macro that expands to
|
||||
such a `bind`. Not reported: a body whose spellings are only its own
|
||||
parameter named like the declaration (unless the body also spells the name
|
||||
after a `.`, or a default argument spells it), and a backtick inside a
|
||||
string. Any doubt means no scoping: a module, interface, package or
|
||||
package member, a declaration outside a module, or one whose home set holds
|
||||
an include lucisv cannot resolve (a macro-built name, a file outside the
|
||||
project such as `uvm_macros.svh`) is reported everywhere as before. On
|
||||
opentitan the `state_q` rename's answer went from 274 lines (61 kB, 230
|
||||
macro warnings, 229 about other modules) to about 72 lines (12 kB),
|
||||
`hmac_core.StIdle`'s from 48 lines to 3.
|
||||
- "Where it can mean it" is the declaration's **home set**: the declaring
|
||||
file, everything it `` `include``s, whatever includes it, and the files the
|
||||
rename edits. A bare spelling in a macro argument of an included fragment,
|
||||
in a header's `` `define`` body invoked from the home set (through other
|
||||
macros too — `ASSERT_DEFAULT_CLK`'s `clk_i`), or in a macro argument of a
|
||||
`bind` into the declaring module is warned about, and a bare use in the
|
||||
plain code of an included fragment (`prim_util_memload.svh`'s `mem`) is
|
||||
named as a use the rename could not edit. Any doubt means no scoping: a
|
||||
declaration outside a module, or one whose home set holds an include
|
||||
lucisv cannot resolve (a macro-built name, a file outside the project such
|
||||
as `uvm_macros.svh`), is warned about everywhere as before; an
|
||||
instantiating module's own same-named signal in a file the rename edits is
|
||||
not reported; a macro whose parameter is named like the declaration, and a
|
||||
backtick inside a string, are not. A bare macro argument the macro carries
|
||||
to the declaration — after a `.` (`` `CONN(state_q)`` building
|
||||
`.state_q(state_q)`, `` `FORCE(state_q)`` building `force u_m.state_q`),
|
||||
into a `bind` into the declaring module, or into a macro lucisv has no
|
||||
definition of — is reported wherever it is written, and so is the body of
|
||||
a macro that expands to such a `bind`.
|
||||
- `duplicate-declaration` also reports a block label beside a port, genvar,
|
||||
typedef, function or task, and two named procedural blocks of one label in
|
||||
one scope.
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
//! hierarchical paths through the name that nothing resolved, and `arms` the
|
||||
//! same-named members of the other arms of its generate labels; `scoped`
|
||||
//! decides which text spellings a warning is about the renamed declaration,
|
||||
//! over `home`'s include-derived home set.
|
||||
//! over `home`'s include-derived home set and `carry`'s macro arguments that
|
||||
//! reach the declaration from any file.
|
||||
|
||||
mod arms;
|
||||
mod carry;
|
||||
|
||||
@@ -463,8 +463,9 @@ fn rework5_an_edited_file_sharing_a_fragment_or_nesting_a_redeclaration() {
|
||||
|
||||
/// N2: a parameter named like the net silences only a body that has no
|
||||
/// other way to the net. A path through the name in the body (`u_m.state_q`)
|
||||
/// can reach it; 0.59.0 warned, rework 5 does not (the parameter check runs
|
||||
/// before `body_dotted` and before the unscoped fallback).
|
||||
/// can reach it; 0.59.0 warned, rework 5 did not (QA P1: the parameter check
|
||||
/// ran before `body_dotted` and the unscoped fallback). Fixed: both now come
|
||||
/// first in `keeps_define_body`.
|
||||
#[test]
|
||||
fn rework5_a_shadowing_parameter_does_not_hide_a_dotted_body_spelling() {
|
||||
let hdr = "`define PATHY(state_q) (state_q + u_m.state_q)\n";
|
||||
@@ -479,8 +480,8 @@ endmodule
|
||||
}
|
||||
|
||||
/// A default argument spelling the name expands into the module when the
|
||||
/// macro is invoked without it. Silent in 0.59.0 too (default arguments were
|
||||
/// never scanned).
|
||||
/// macro is invoked without it. Silent in 0.59.0 too (QA P2: default
|
||||
/// arguments were never scanned); now scanned with the body.
|
||||
#[test]
|
||||
fn rework5_a_default_argument_spelling_the_name_is_said() {
|
||||
let hdr = "`define DFLT(x = state_q) (x)\n";
|
||||
|
||||
@@ -65,8 +65,31 @@ resolution print watches it unchanged.
|
||||
name.
|
||||
- `lucisv_mcp/src/tools/edit.rs`: the `block`-kind rename refusal is removed.
|
||||
|
||||
The rename engine (`vlog_refactor/src/rename/`) and the verifier
|
||||
(`check/`) are unchanged in code: the verifier gained no normalization.
|
||||
That was the first pass. The reworks and the review fixes then changed the
|
||||
engine's *warnings* and *messages*, never what a rename rewrites:
|
||||
|
||||
- `vlog_refactor/src/rename/paths.rs` (rework 1, F1): a hierarchical path
|
||||
segment spelling the name that resolved to nothing, in any file of the
|
||||
set, is warned about with its lines.
|
||||
- `rename/arms.rs` (rework 1, F2): the same-named member of another arm of
|
||||
the renamed member's generate label is warned about.
|
||||
- `bind/mod.rs`, `vlog_linter` `duplicate-declaration` (rework 1, F3): a
|
||||
label beside a net is a duplicate, not a use; `lib.rs::member_key`
|
||||
qualifies a subroutine's block (F4).
|
||||
- `scope.rs::name_of` / `name_at` (rework 2, R1): a file whose base name
|
||||
another file of the set shares is named by its path in every
|
||||
refactoring's messages, the verifier's included; counted once per set
|
||||
(`BaseNames`, review M-2).
|
||||
- `rename/home.rs`, `rename/scoped.rs` (reworks 3–5): rename warnings scoped
|
||||
to the declaration's home set; `lucisv_mcp/src/tools/mentions.rs`
|
||||
(`Focus::local`) scopes mentions the same way.
|
||||
- `rename/carry.rs` (review H-1/H-2): a macro argument the macro carries to
|
||||
the declaration is warned about wherever it is written.
|
||||
- `scoped.rs::fragment_use_warnings` (review M-1): a use the rename edits is
|
||||
not reported as left unchanged.
|
||||
|
||||
The verifier (`check/`) gained no normalization: its only change is how it
|
||||
names files in its messages (R1).
|
||||
|
||||
## Assumptions
|
||||
|
||||
@@ -241,6 +264,16 @@ The rename engine (`vlog_refactor/src/rename/`) and the verifier
|
||||
- [x] rework F3: a label beside a net is a duplicate, not a use
|
||||
- [x] rework F4: function/task-local block keys never collide
|
||||
- [x] TODO §65.4 filed (root lookup for `tb.…` paths)
|
||||
- [x] rework 2 (R1–R4): path-qualified file names; `WholeSet::rooted` built
|
||||
once per set
|
||||
- [x] rework 3: rename warnings and mentions scoped to the declaration
|
||||
- [x] rework 4 (H1–H4): the home set; fragments' plain uses said
|
||||
- [x] rework 5 (K1–K3, N1–N3): unscoped on any doubt
|
||||
- [x] QA closing-check P1 (a shadowing parameter no longer hides a dotted
|
||||
body spelling) and P2 (a default argument spelling the name is said)
|
||||
- [x] TODO §65.6 filed (rename inside included fragments)
|
||||
- [x] independent review (`oct_review.md`): H-1, H-2, M-1, M-2 fixed; M-3
|
||||
(these docs)
|
||||
|
||||
## Work log
|
||||
|
||||
@@ -565,6 +598,33 @@ launching the freshly linked `vlog_semantic/tests/struct_members` binary
|
||||
(`syspolicyd` at 71 % CPU: the §65.3 stall), limit not raised; the
|
||||
identical re-run passed.
|
||||
|
||||
**2026-10-07 — fix for review M-2.** `Scope::name_of` scanned every source
|
||||
per call, and `define_warnings` / `macro_use_warnings` named every file of
|
||||
the set before looking for a site — two quadratic passes, about 0.5 s of an
|
||||
opentitan rename. The base-name counts are now built once per set
|
||||
(`scope::BaseNames`, kept on the `Scope` and on the port offers' `Files`;
|
||||
`name_among` folded into it). Engine probe, whole `hw`,
|
||||
`entropy_src_main_sm.state_q`: 2.95 s → 2.23 s (defines 326 → 7 ms, macro
|
||||
arguments 394 → 77 ms), the same 47 warnings. Unit test
|
||||
`scope.rs` `a_file_name_another_file_shares_is_named_by_its_path`.
|
||||
|
||||
**2026-10-07 — docs for review M-3.** "What changed" now covers the reworks
|
||||
and the review fixes; the claim that the engine and the verifier were
|
||||
"unchanged in code" was stale after rework 2 (the verifier names files by
|
||||
`name_of`) and rework 3 (the warning modules) — what a rename *rewrites* is
|
||||
unchanged, and the verifier still gained no normalization. Status lists
|
||||
reworks 2–5, P1/P2 and §65.6. **P1/P2:** QA's closing check left
|
||||
`rework5_a_shadowing_parameter_does_not_hide_a_dotted_body_spelling` and
|
||||
`rework5_a_default_argument_spelling_the_name_is_said` ignored, but at
|
||||
review time the tree already held the fix with no work-log entry: in
|
||||
`scoped.rs::keeps_define_body` the unscoped fallback and a dotted body
|
||||
spelling come before the shadowing-parameter check, and a parameter named
|
||||
like the declaration silences nothing when a default argument spells the
|
||||
name bare (`DefineSite::default_bare`, scanned in
|
||||
`warnings.rs::define_sites_with`). Both tests run un-ignored and pass; their
|
||||
stale doc comment ("rework 5 does not") is corrected. Topo row 40's second
|
||||
half is marked answered; the CHANGELOG's two scoping bullets are merged.
|
||||
|
||||
## QA log
|
||||
|
||||
**2026-09-30 — QA agent (Opus).** Verdict: **PASS with findings** — no
|
||||
|
||||
@@ -1381,6 +1381,14 @@ surface under `module.label`), after which a missed segment is a reference
|
||||
that stops resolving and the existing resolution print refuses it — pinned by
|
||||
eight attacks in `check/qa_block_paths.rs`. `docs/features/generate-label-rename`.
|
||||
|
||||
**2026-10-07 — correction (independent review M-3).** The 2026-09-30 entry
|
||||
above says the engine and the verifier are "unchanged in code"; that held
|
||||
for the first pass only. The §65.1 reworks added rename-warning modules
|
||||
(`rename/paths.rs`, `arms.rs`, `home.rs`, `scoped.rs`, later `carry.rs`) and
|
||||
path-qualified file names in every refactoring's messages, the verifier's
|
||||
included (`Scope::name_of`). What a rename rewrites, and what the verifier
|
||||
forgives, did not change. `docs/features/generate-label-rename`.
|
||||
|
||||
## QA log
|
||||
|
||||
**2026-08-24 — QA agent.**
|
||||
|
||||
+1
-1
@@ -710,7 +710,7 @@ update the filing README(s) and this file.
|
||||
| 37 | **MCP-7 → `vlog_refactor`:** a `find_references` variant taking `&dyn KnownFacts` (like `rename_traced_with`) so whole-set callers feed cached records instead of re-parsing 3 944 files (≈2 s per opentitan call today) | mcp-navigation | vlog_refactor |
|
||||
| 38 | **MCP-8 → `vlog_refactor`:** false `remove_port` refusal when the only "use" of the port is a named connection from another module in the same file (`ports/remove.rs::body_uses_in`) | mcp-edit-tools | vlog_refactor |
|
||||
| 39 | **MCP-10 → `vlog_refactor`:** `extract_module` writes LF into a CRLF file (`extract/render.rs`) | mcp-edit-tools | vlog_refactor |
|
||||
| 40 | **MCP-11/12 → `vlog_refactor`/`vlog_semantic`:** a batched `find_references` for several declarations; `find_references` misses a hierarchical use into a generate loop (`gen_l[0].z`) | mcp-structural-edits | vlog_refactor, vlog_semantic |
|
||||
| 40 | **MCP-11/12 → `vlog_refactor`/`vlog_semantic`:** a batched `find_references` for several declarations; ~~`find_references` misses a hierarchical use into a generate loop (`gen_l[0].z`)~~ — **second half answered 2026-09-30 by generate-label-rename (TODO §65.1, row 43)**; the batched `find_references` stays open | mcp-structural-edits | vlog_refactor, vlog_semantic |
|
||||
| 41 | **MCP-13 → `vlog_linter`:** a forced deletion of a non-ANSI body port leaves a header port with no direction and no lint reports it | mcp-structural-edits | vlog_linter |
|
||||
| 42 | **Parser leniency → `vlog_parser`:** a trailing `,` in a named connection list, an empty concatenation element `{d,, d}`, and `type(x)'(y)` in a connection parse without a diagnostic (the rename verifier's position rule covers the rename; every other splice contract is exposed) | refactor-rename (M3.5) | vlog_parser |
|
||||
| ~~43~~ | ~~**MCP-14 → `vlog_refactor`/`vlog_semantic`:** rename of a generate block label leaves hierarchical paths through it unrewritten and `find_references` does not report them — vlog_refactor/vlog_semantic; the MCP layer refuses the rename; the LSP still allows it~~ — **closed 2026-09-30 by generate-label-rename (TODO §65.1, 0.60.0):** the gap was resolution, not the rename — `vlog_semantic` now declares a `for` block's label in the enclosing scope (the genvar stays in the header), treats `generate … endgenerate` as no scope, gives a named block a member scope, walks an index in a path as the name it indexes, and puts blocks on a module's hierarchical surface with their members under the synthesized key `module.label` (`FACTS_FORMAT` 21; `Semantics::member_key`, which `lucisv_server/src/nav.rs` now asks with). Every segment — bare, indexed, nested, cross-file — and the closing label are ordinary references, so `find_references`, `rename` (LSP, CLI engine, MCP) and the verifier's unchanged resolution print all see them; no verifier normalization was added, eight attacks pin that (`check/qa_block_paths.rs`). `lucisv-mcp`'s `block` refusal is lifted. Also answers row 40's second half (`gen_l[0].z` is found). | mcp-lean-catalogue | vlog_refactor, vlog_semantic |
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ It is a read-only review. The only file written is this one.
|
||||
- **Suggested fix:** compute the name only when sites exist, or build base-name counts once per `Scope`.
|
||||
- **Same pattern, smaller cost:** `ports/offer.rs:251` (`name_among` per mentioning file, on the code-action path).
|
||||
|
||||
### M-3. The docs contradict the code and leave out the last fix
|
||||
### M-3. The docs contradict the code and leave out the last fix — **FIXED 2026-10-07**
|
||||
|
||||
- **README says engine and verifier are unchanged.** `docs/features/generate-label-rename/README.md:68-69` says "The rename engine (`vlog_refactor/src/rename/`) and the verifier (`check/`) are unchanged in code". `refactor-rename/README.md` (the 2026-09-30 work log) and topo row 43 say the same. All three are stale:
|
||||
- reworks 2–5 added `rename/{arms,home,paths,scoped}.rs` and rewrote `warnings.rs`;
|
||||
|
||||
Reference in new issue
Block a user