LSP §9c: textDocument/typeDefinition
From a name to its type's declaration: variable to typedef/enum/struct, handle to class, instance name to module, interface signal to interface. The whole feature is one redirection — find where the declaration wrote its type name (the same window vlog_semantic's binder searched), then run nav::definition there — so cross-file resolution, ambiguity, and position conversion are F12's, unchanged. One hop on typedef aliases, never a chain; built-ins answer empty. One stopgap with a three-condition fence: vlog_semantic reports an unqualified lexical miss as NotFound — or InheritedCandidate inside any extending class, the UVM norm — without consulting the workspace overlay, so indexed_type asks the index directly for file-scope Module/Class/Typedef declarations only, never for a qualified member (the lead-added guard: a pkg:: qualifier must not be discarded into a bare-name sweep — proven by deliberate breakage). The Handshake filed in the README covers promoting both miss spellings so the whole fallback deletes when vlog_semantic lands it. Also filed: the parser gap where an ANSI header's direction-less first port fails to parse. QA rejected the first cut — the corpus sweep found the InheritedCandidate miss live on ibex DV files — and the fix round answered with a one-pattern widening whose safety was derived from three independent vlog_semantic citations. 45 unit tests + 1 e2e; the corpus spot-check now asserts two real UVM-shaped jumps positively. docs/features/type-definition/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
dbd2f176aa
commit
5d0725c158
8 files changed
+2257
-11
No files matched your search
@@ -28,6 +28,7 @@ looks like language knowledge in here is a bug or a `Handshake` request.
|
||||
| `textDocument/semanticTokens/full/delta` | the same classification pass | What changed since the answer the client names: one edit replacing everything between the common prefix and the common suffix (the suffix capped so the two cannot overlap — identical lines of Verilog encode identically, which is exactly the trap). An id the server does not hold, including one from before a `didClose`, is answered in full. Same feature README |
|
||||
| `textDocument/hover` | `DefineTable`, `Semantics`, `WorkspaceIndex`, `includes::IncludeGraph`, `expand` | Macro body, or declaration kind + snippet. A macro this file does not define is answered from the workspace: the definition it **reaches through its `` `include``s** when exactly one is reachable, and every candidate otherwise. A macro card also shows what the hovered use **expands to in one step** — the body with this call's arguments substituted — when that says more than the body already does; a nested `` `INNER`` is left as written, an argument count that does not match expands nothing, and several candidates expand nothing. See `docs/features/macro-expansion/README.md` |
|
||||
| `textDocument/definition` | `includes::IncludeGraph`, then `Semantics`, then `ExternalResolutions` | A cursor on an `` `include`` line jumps to the resolved file's first byte; otherwise the in-file symbol table, then the workspace overlay, whose `Ambiguous` answer returns every location. See `docs/features/include-nav/README.md` |
|
||||
| `textDocument/typeDefinition` | `type_def`, then `nav::definition` | The same jump one token to the left: from a name to where its **type** is declared — a `typedef`, an `interface`, a `class`, or the module an instance name stands for. The tree says which declaration a position is in and where its type name is written; the answer is then `definition` of *that* name, so cross-file resolution, ambiguity and position conversion are all the ones F12 already uses. One hop on an alias chain, an empty list for a built-in. See `docs/features/type-definition/README.md` |
|
||||
| `textDocument/documentLink` | `includes::IncludeGraph` | One link per **resolvable** `` `include``, covering the quoted path, target already resolved (`resolveProvider: false`). Search order: the including file's own directory, then each `+incdir+` of the configured filelist in order; the `<angled>` form skips the first rung. An include nothing answers to gets no link and no error. Same feature README |
|
||||
| `textDocument/references` | `vlog_refactor::find_references`, else `Semantics::references_of` | Cross-file when the symbol is one the workspace index holds (a module, a package, an exported member, a port); in-file for everything else, which is what keeps a local `wire` off the workspace walk. See `docs/features/references-nav/README.md` |
|
||||
| `textDocument/documentHighlight` | `pairs::analyze`, else `Semantics::references_of` | A scope keyword highlights its own closer; anything else highlights the symbol's occurrences in this file. Kind is always `Text`; neither answer means `null`, so the editor keeps its word highlighting. Same feature README |
|
||||
@@ -383,7 +384,12 @@ done here:
|
||||
a backtick, distinguished by the existing public `Token::is_macro()` —
|
||||
which is enough, so this is a note, not a request.
|
||||
4. **`vlog_semantic`: nothing.** The queries needed for all six navigation
|
||||
capabilities existed exactly as documented.
|
||||
capabilities existed exactly as documented. *(One request has since been
|
||||
filed by type-definition: an unqualified name nothing in the file binds is
|
||||
reported `NotFound` rather than as an external candidate, so the workspace
|
||||
overlay never sees it — which is how an `interface` type is written. Stated
|
||||
in full, with the fenced workaround it stands in for, in
|
||||
`docs/features/type-definition/README.md`.)*
|
||||
|
||||
## The `semanticTokens` mapping
|
||||
|
||||
@@ -508,6 +514,11 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
|
||||
`docs/features/semantic-tokens-delta/README.md`.
|
||||
- [x] `textDocument/hover`.
|
||||
- [x] `textDocument/definition`.
|
||||
- [x] `textDocument/typeDefinition` — delivered by **type-definition**
|
||||
(2026-08-26, TODO.md §9c): the type half of go-to-definition, computed
|
||||
by redirecting the position to the type name the declaration writes and
|
||||
answering with `nav::definition` from there. No engine change.
|
||||
`docs/features/type-definition/README.md`.
|
||||
- [x] `textDocument/references`.
|
||||
- [x] `textDocument/documentSymbol` + `workspace/symbol`.
|
||||
- [x] Unit tests for the position conversion, including surrogate pairs.
|
||||
|
||||
@@ -0,0 +1,691 @@
|
||||
# type-definition
|
||||
|
||||
## Goal
|
||||
|
||||
`textDocument/typeDefinition` (TODO.md §9c): from a name to the declaration of
|
||||
that name's **type**. Go-to-definition answers "where does this name come
|
||||
from"; this answers "where does this name's *type* come from" — from
|
||||
`my_pkg::state_t s;` to the `typedef` of `state_t`, from `bus_if bus` or
|
||||
`virtual bus_if vif` to the `interface bus_if`, from the instance name of
|
||||
`sub u_sub (...)` to `module sub`, and from `my_cls h;` to `class my_cls`. It
|
||||
is the second-most-used navigation key in an editor after F12, it is exactly
|
||||
the jump a Verilog reader wants when a signal is a package enum declared three
|
||||
files away, and — this is why it is cheap — the answer is a location
|
||||
`textDocument/definition` already knows how to compute. Everything this
|
||||
feature adds is *which offset to ask about*.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **A declaration's type is written as an identifier, and `vlog_semantic`
|
||||
recorded it as a use.** `bind.rs::bind_data_type` calls `use_name` for every
|
||||
non-keyword type name, searching the window from the start of the
|
||||
declaration to the first name it declares. This feature finds that same
|
||||
window from the parse tree and picks the reference the binder left in it. A
|
||||
keyword type (`logic`, `wire`, `int`) is never a reference, which is what
|
||||
makes "a built-in has no type definition" fall out with no special case.
|
||||
- **One hop, never a chain.** With `typedef state_t alias_t; alias_t x;` the
|
||||
cursor on `x` lands on `alias_t`'s typedef, not on `state_t`'s. That is what
|
||||
every editor's go-to-type-definition does; the user presses the key again for
|
||||
the next hop, and each hop is a place they can read. Chasing the chain to its
|
||||
root would land somewhere the source never mentioned.
|
||||
- **The cursor on a type name answers for that name.** `state_t` in
|
||||
`state_t s;` is already a type, so its type definition is its own
|
||||
declaration — the same location F12 gives there. Pinned by a test either
|
||||
way, since it is the one position where "definition" and "type definition"
|
||||
visibly coincide.
|
||||
- **A declaration name is not a use.** The cursor on the `alias_t` *of*
|
||||
`typedef state_t alias_t;` takes the hop its declaration offers (`state_t`)
|
||||
rather than answering itself, which would waste the keystroke.
|
||||
- **A `module`, `interface` and `program` are one AST node and one
|
||||
`SymbolKind::Module`**, so an interface is reached by exactly the code that
|
||||
reaches a module.
|
||||
- **The tree is the tolerant parse.** A declaration inside an `Error` node is
|
||||
no declaration at all and answers nothing — the same degradation every other
|
||||
tree-reading handler has (`docs/features/error-recovery/README.md`).
|
||||
- **An `InheritedCandidate` in a *type position* is a lexical miss, not an
|
||||
answer.** `resolve.rs`'s `miss` turns *every* miss inside a class carrying an
|
||||
`extends` into `Resolution::InheritedCandidate`, whether or not the name has
|
||||
anything to do with inheritance — so in a type window it means only "a base
|
||||
class *might* declare this type". `vlog_semantic` never chases a base chain
|
||||
(in this file or out of it: `lexical` walks `scope.parent`, which is lexical
|
||||
nesting, and `miss` records the base's *name* and stops; `resolve_external`
|
||||
only finishes an `ExternalCandidate`), so no layer can turn that into a
|
||||
location, and the workspace's file-scope type of that name is the best
|
||||
honest answer available. This is assumed, not enforced: a base class that
|
||||
genuinely declares a nested type of the same name would be the better answer,
|
||||
and nothing here can produce it — but nothing displaces it either, because
|
||||
the fallback is consulted only after `nav::definition` came back empty. The
|
||||
day `vlog_semantic` does chase a base, such a reference becomes
|
||||
`Resolution::Resolved`, `definition` answers it, and the fallback is never
|
||||
reached. Pinned by
|
||||
`an_in_file_bases_nested_typedef_does_not_beat_the_workspace_type_because_nothing_finds_it`.
|
||||
|
||||
## Handshakes
|
||||
|
||||
**Consumed from `vlog_parser`:** `ast::{Item, ItemKind, Module, PortList,
|
||||
AnsiPort, ParamPort, TfArg, DataType, Declarator, Typedef, TypedefKind,
|
||||
Instantiation, GenIf, GenElse, GenBlock, Stmt, StmtKind}` and `TextRange`.
|
||||
Read-only; nothing was changed.
|
||||
|
||||
**Consumed from `vlog_semantic`:** `Semantics::{references, reference_at,
|
||||
symbol}`, `Reference::{name, name_span, resolved}`, `Resolution::NotFound`,
|
||||
`SymbolKind`, and `WorkspaceIndex::{units, path}` for the one fallback below.
|
||||
Read-only; nothing was changed.
|
||||
|
||||
**Consumed from this crate:** `nav::definition` (the whole answer),
|
||||
`nav::symbol_at` — widened from private to `pub(crate)` so the two handlers
|
||||
cannot disagree about what a position names — and `locate::location`.
|
||||
|
||||
**Promised:** `type_def::type_definition(ws, uri, offset) -> Vec<Location>`,
|
||||
serving `server.rs`'s `GotoTypeDefinition` arm. Same answer shape as
|
||||
`GotoDefinition`: an array in every case, empty where there is nothing to jump
|
||||
to, every candidate where the workspace declares the name twice, and an empty
|
||||
array (not `null`) for a buffer the server was never sent.
|
||||
|
||||
**Requested of other modules** — neither blocked this round, and neither was
|
||||
done here:
|
||||
|
||||
1. **`vlog_semantic`: report an unresolved *unqualified* name as an external
|
||||
candidate, not as a bare lexical miss.** `resolve.rs`'s `lexical` miss ends
|
||||
in `Resolution::NotFound` whenever the file collected no import paths on the
|
||||
way out — or, inside a class with an `extends`, in
|
||||
`Resolution::InheritedCandidate` — and neither reaches `resolve_external`,
|
||||
so the workspace overlay never sees the name. That is precisely how an
|
||||
`interface` is written (`bus_if bus;` — interfaces live at file scope, not
|
||||
in packages) and how a package-less `class` is used, so the two headline
|
||||
cross-file cases of this feature would answer nothing; and the
|
||||
`InheritedCandidate` half covers nearly every UVM class, since almost all of
|
||||
them extend something. The ask: for a `Target::Lexical` miss, emit
|
||||
`ExternalCandidate { paths: vec![name] }` — the same shape `Target::Module`
|
||||
already emits — **in both spellings**, i.e. also carry the bare name in the
|
||||
`paths` of an `InheritedCandidate`, so the index's unit table finishes it
|
||||
without losing the recorded base. Until then this feature asks the index
|
||||
itself, in one function (`indexed_type`) fenced by three conditions: only
|
||||
for a reference the file reported as one of those two misses, only for a
|
||||
**file-scope** declaration, and only for the kinds that can be a type
|
||||
(`Module`, `Class`, `Typedef` — a `package` of that name is not one). When
|
||||
the request above lands, that function is deleted and nothing else in this
|
||||
module changes.
|
||||
2. **`vlog_parser`: an ANSI header whose *first* port carries no direction does
|
||||
not parse.** `module m (bus_if bus, input logic clk);` becomes an `Error`
|
||||
item, while `module m (input logic clk, bus_if bus);` parses fine — the
|
||||
list is classified ANSI-or-not from its first element, and a bare
|
||||
`type name` pair reads as neither a non-ANSI name list nor a directed port.
|
||||
`module m (bus_if.mp bus)` (a modport-qualified port) and
|
||||
`module m (my_pkg::state_t s)` do not parse either. Not this feature's to
|
||||
fix, and not a regression it caused: the tests here write the interface
|
||||
port second and say why.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] `crates/lucisv_server/src/type_def.rs`: the offset redirection, the
|
||||
declaration walk, and the index fallback.
|
||||
- [x] `type_definition_provider` advertised (`TypeDefinitionProviderCapability::Simple(true)`).
|
||||
- [x] `GotoTypeDefinition` dispatched in `server.rs`, on `GotoDefinition`'s
|
||||
conventions exactly.
|
||||
- [x] `nav::symbol_at` shared rather than re-implemented.
|
||||
- [x] 24 unit tests: typedef, enum/struct typedef, class handle (module item
|
||||
and method body), module instance, interface instance / port / `virtual`
|
||||
handle, header parameter, task argument, generate block, `pkg::t`,
|
||||
`import pkg::*` + bare name, cross-file interface, cross-file class,
|
||||
built-ins, a package that is not a type, a refused qualified name, an
|
||||
unopened buffer, a position on no name, ambiguity, UTF-16 positions,
|
||||
one-hop aliasing.
|
||||
- [x] **Fix round (2026-08-26):** `indexed_type`'s fence widened to accept
|
||||
`Resolution::InheritedCandidate` as well as `NotFound`, closing the QA
|
||||
finding below (a cross-file type used as a member of any `extends`-ing
|
||||
class — nearly every UVM class — answered nothing). 4 tests added, QA's
|
||||
regression test flipped, corpus spot-check assertions flipped positive.
|
||||
- [x] One e2e round trip: the capability in the real handshake, a cross-file
|
||||
package typedef, and a built-in answered with an empty array.
|
||||
- [x] TODO.md §9c checkbox; `docs/features/lucisv-server/README.md` capability
|
||||
table.
|
||||
- [ ] **Not done, deliberately:** a function's *return* type is not a site — a
|
||||
cursor on `f` in `function state_t f();` answers nothing. It is a
|
||||
defensible answer to give and a defensible one to withhold, and giving it
|
||||
needs a guard (the cursor must be in the header, not in the body) that
|
||||
the other sites do not, so it waits for somebody to ask for it.
|
||||
- [ ] **Not done, deliberately:** a `bind` directive's instance. Its name is
|
||||
declared into another module's scope, so this file is not the one to
|
||||
answer for it (`docs/features/bind/README.md`).
|
||||
- [ ] **Not done:** a member's type (`x.field`, `h.member`). `vlog_semantic`
|
||||
does not resolve member access at all, so there is no symbol to ask about
|
||||
— the same boundary hover and `references` stop at.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-08-26 — dev agent
|
||||
|
||||
- **Read the semantic layer before writing anything, and the key question came
|
||||
back "no, but".** A `Symbol` carries no type: its `decl_span` is its
|
||||
*declarator* (`bind.rs::bind_declarators` passes `d.span`), so the type name
|
||||
is outside every span the symbol table holds, and there is no `type` field
|
||||
anywhere in `model.rs`. What the crate *does* have is the type name as an
|
||||
ordinary `Reference` — `bind_data_type` calls `use_name` on it, resolved
|
||||
lexically or as a `pkg::` member — which is the whole feature: the answer is
|
||||
`nav::definition` of the type name's own offset. So `vlog_semantic` was not
|
||||
modified, as the brief required, and the only thing that had to be built is
|
||||
the map from *a position* to *the type name's position*.
|
||||
- **That map needs the tree, and is offset-driven, which kept it small.**
|
||||
`site_at` descends items, module headers, class bodies, generate blocks and
|
||||
statements, pruning by span containment exactly as `selection.rs` does, and
|
||||
returns the one declaration covering a position: the type name as written
|
||||
plus the window it was written in. The window is deliberately the same one
|
||||
the binder searched (start of the declaration → start of the first declared
|
||||
name), which turns "where is the type name" into a *match* against the
|
||||
reference table rather than a scan of the text. A qualified type is two
|
||||
references (`pkg`, then `state_t`) and the second is the one worth jumping
|
||||
to, so a name with `::` is matched by its last segment; an instantiation
|
||||
stores its name glued, so the whole name is tried first.
|
||||
- **New module, not an extension of `nav.rs`.** `nav.rs` is definition +
|
||||
references + highlights over `Semantics` alone; this needs a parse-tree walk
|
||||
that has no reader there, and the two things it borrows from `nav` (the
|
||||
`definition` call and `symbol_at`) are a public function and a one-word
|
||||
visibility change. Adding ~250 lines of AST walking to a 625-line module
|
||||
whose subject is the symbol table would have made both harder to read.
|
||||
- **One walk, not a reuse of `instantiations::sites`.** That walk finds
|
||||
instantiations only, and this one has to visit declarations in the same
|
||||
containers; running both would mean descending generate blocks twice and
|
||||
keeping two lists of container node kinds in step. The instantiation arm here
|
||||
is two lines.
|
||||
- **The cross-file gap found by a failing test, and fenced rather than
|
||||
papered over.** `bus_if bus` and `my_cls h` — an unqualified type name
|
||||
nothing in the file binds — resolve to `Resolution::NotFound`, never to an
|
||||
external candidate, so the workspace overlay never sees them and the two
|
||||
headline cross-file cases returned nothing. Fixing that properly is a
|
||||
`vlog_semantic` change this round may not make, so it is written up as
|
||||
Handshake request 1 and stood in for by `indexed_type`: the index's own unit
|
||||
table, asked only for a `NotFound` reference, only for file-scope
|
||||
declarations, and only for kinds that can be a type. Two tests pin the
|
||||
fence — a `package` of the same name is not an answer, and a `pkg::missing_t`
|
||||
the overlay already refused is not retried against a decoy module of that
|
||||
name.
|
||||
- **Two parser limitations found and recorded, neither touched**: an ANSI
|
||||
header whose first port has no direction does not parse, and neither does a
|
||||
modport-qualified or package-qualified header port. Handshake request 2. The
|
||||
interface-port tests write the port second and carry a comment saying why, so
|
||||
the day the parser improves the tests read as deliberate rather than
|
||||
mysterious.
|
||||
- **Conventions followed exactly rather than re-decided**: the answer is an
|
||||
array in every case (`GotoDefinition`'s shape, including the empty array for
|
||||
an unopened buffer, which is what `self.offset(...).unwrap_or_default()`
|
||||
means at both call sites); ambiguity returns every location; positions go
|
||||
through `Positions`/`locate::location`, so UTF-16 is not this module's
|
||||
problem and is pinned by a test anyway.
|
||||
- **No new dependencies, no version bump, no engine crate touched.** Files
|
||||
added: `crates/lucisv_server/src/type_def.rs`, this README. Files edited:
|
||||
`main.rs` (module line, capability, capability test), `server.rs` (imports,
|
||||
one dispatch arm), `nav.rs` (one visibility word plus its doc line),
|
||||
`tests/e2e.rs` (one round trip), `TODO.md` (§9c checkbox),
|
||||
`docs/features/lucisv-server/README.md` (capability table + Status).
|
||||
- **Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets`:
|
||||
0 warnings. `cargo test --workspace`: green. `cargo build && node
|
||||
editors/vscode/smoke.js target/debug/lucisv-server`: pass. No `git commit`,
|
||||
no `git push`.
|
||||
|
||||
### 2026-08-26 — dev agent (fix round: the QA finding)
|
||||
|
||||
- **The fence widened by one pattern, nothing else.** `indexed_type`'s first
|
||||
condition now reads
|
||||
`Some(Resolution::NotFound | Resolution::InheritedCandidate { .. })`
|
||||
(`crates/lucisv_server/src/type_def.rs:138`). The other two — file-scope
|
||||
declarations only (structurally, because `WorkspaceIndex::units` holds
|
||||
nothing else) and `Module`/`Class`/`Typedef` kinds only — are untouched, as
|
||||
is every other line of the module. The doc comment now explains *why* the two
|
||||
resolutions are one case: they are the two spellings `resolve.rs`'s `miss`
|
||||
gives the same event, and which one you get depends only on whether an
|
||||
`extends` happens to be overhead.
|
||||
- **The precedence question, answered by reading rather than assumed.** The
|
||||
brief asked whether in-file inherited resolution can already produce a
|
||||
location for an in-file base's nested typedef, so that the widening might
|
||||
displace a better answer. It cannot, at three independent points:
|
||||
`resolve.rs::lexical` (`crates/vlog_semantic/src/resolve.rs:39-70`) walks
|
||||
`scope.parent`, which is *lexical* nesting and never a base class's scope;
|
||||
`miss` (`:201-213`) records the base's name and stops, exactly as its own doc
|
||||
comment says ("which this crate never chases, in this file or out of it");
|
||||
and `resolve_external` (`crates/vlog_semantic/src/workspace.rs:382-391`)
|
||||
skips anything that is not an `ExternalCandidate`, so an `InheritedCandidate`
|
||||
never reaches the overlay either. So the fallback displaces an empty answer,
|
||||
not a better one. Precedence also needs no code of its own now or later,
|
||||
because `indexed_type` is consulted only after `nav::definition` came back
|
||||
empty (`type_def.rs:58-63`): the day `vlog_semantic` does chase a base, the
|
||||
reference becomes `Resolved`, `definition` answers the nested typedef, and
|
||||
the fallback is never reached — the same mechanism that already makes a local
|
||||
genvar of the same name win. Written up in Assumptions and pinned by
|
||||
`an_in_file_bases_nested_typedef_does_not_beat_the_workspace_type_because_nothing_finds_it`,
|
||||
which asserts both halves: the resolution really is `InheritedCandidate`
|
||||
(so nothing found the nested typedef) and the answer really is the workspace
|
||||
interface.
|
||||
- **QA's regression test flipped, name and fixture kept.**
|
||||
`a_class_scoped_type_reference_in_an_extending_class_is_never_found_cross_file`
|
||||
→ `..._is_found_cross_file`, same portable fixture, and it still asserts the
|
||||
resolution is `InheritedCandidate` — the point being that the fence widened
|
||||
and `vlog_semantic` did not.
|
||||
- **Four tests added** (`type_def.rs`, all portable, no corpus):
|
||||
`a_uvm_shaped_member_type_resolves_cross_file_from_an_extending_class` (the
|
||||
ibex shape: a base class that is nowhere in the workspace, two cross-file
|
||||
interfaces as member types, reached from both the type half and the
|
||||
declarator half);
|
||||
`an_in_file_bases_nested_typedef_does_not_beat_the_workspace_type_because_nothing_finds_it`
|
||||
(the precedence determination above);
|
||||
`a_non_type_inherited_reference_is_still_never_a_type_site` (an ordinary
|
||||
expression identifier inside an extending class — the one place the widening
|
||||
could have leaked, and it does not, because no `Site` is built for an
|
||||
expression statement so the fence is never even consulted); and
|
||||
`the_other_two_fence_conditions_still_hold_under_an_inherited_candidate`
|
||||
(three arms, all from inside an extending class: a `package` of that name is
|
||||
still not a type; a package *member* typedef is still not file-scope and so
|
||||
is not in the unit table; a `pkg::missing_t` the overlay already refused is
|
||||
still not retried against a decoy module of that name).
|
||||
- **The corpus spot-check now asserts the fix on the file that found it.**
|
||||
`corpus_spot_check_real_uvm_files_no_panic_and_known_jumps`'s two "known gap"
|
||||
assertions on `dv/uvm/core_ibex/env/core_ibex_env_cfg.sv` became positive
|
||||
ones: `clk_rst_if` and `core_ibex_dut_probe_if` each jump to exactly one
|
||||
location, in `clk_rst_if.sv` and `core_ibex_dut_probe_if.sv` respectively.
|
||||
Not brittle: both are `virtual <iface> <name>;` members of a class the file
|
||||
opens with, both interfaces are vendored in this checkout under those file
|
||||
names, and the probes match on the multi-space alignment the file uses. The
|
||||
test still skips itself when `corpus/` is absent, and
|
||||
`scrambling_key_agent_cfg` — a class genuinely not vendored here — is still
|
||||
asserted empty, which is what keeps the widening from reading as "answer
|
||||
something, anything".
|
||||
- **Scope.** Files edited: `crates/lucisv_server/src/type_def.rs` (one match
|
||||
pattern, its doc comment, the test module) and this README. `vlog_semantic`
|
||||
untouched; `TODO.md` needed no truth fix (its §9c line claims the capability,
|
||||
which was true before this round and is more true after). Test count in
|
||||
`type_def.rs`: 42 (was 38).
|
||||
- **Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets
|
||||
--workspace`: 0 warnings. `cargo test --workspace`: green (748 passed / 4
|
||||
ignored in `lucisv_server`'s own suite, 0 failed anywhere). `cargo build &&
|
||||
node editors/vscode/smoke.js target/debug/lucisv-server`: `smoke: OK`. No
|
||||
`git commit`, no `git push`.
|
||||
|
||||
## QA log
|
||||
|
||||
### 2026-08-26 — QA agent (continuation of an interrupted run)
|
||||
|
||||
This run resumed a QA pass interrupted mid-way. The prior pass had already
|
||||
added 13 tests to `crates/lucisv_server/src/type_def.rs` (all still present,
|
||||
all re-run and green below) but had not yet written anything to this log —
|
||||
its work is folded into the write-up below rather than repeated as a separate
|
||||
entry, since there was nothing here to distinguish "already recorded" from
|
||||
"found this session." What follows covers the full original checklist.
|
||||
|
||||
**A. Gates — all green, re-run from a clean state:**
|
||||
|
||||
- `cargo fmt --all -- --check`: clean.
|
||||
- `cargo clippy --all-targets --workspace`: 0 warnings.
|
||||
- `cargo test --workspace`: green throughout, including after every change
|
||||
this session made (744 passed / 4 ignored in `lucisv_server`'s own suite,
|
||||
0 failed anywhere in the workspace both before and after).
|
||||
- `cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`:
|
||||
`smoke: OK`.
|
||||
|
||||
**B. Attack surfaces.**
|
||||
|
||||
1. **`indexed_type` fence** — verified clean, with one finding (below).
|
||||
- Shadowing locals: `a_local_declaration_of_the_same_name_wins_over_the_workspace_type`
|
||||
(type_def.rs:813) — a genvar named `bus_if` in scope where `bus_if` is
|
||||
also a workspace interface; `lexical` resolves it locally
|
||||
(`Resolution::Resolved`), the fence's first condition never fires, and
|
||||
the answer is the genvar's own declaration. Re-run, passes.
|
||||
- Non-type positions (structural confinement to type windows): `a_plain_expression_use_of_a_workspace_module_name_is_never_a_type_site`
|
||||
(type_def.rs:863) — `assign x = dup;` where `dup` is also a workspace
|
||||
module name; no `Site` is ever built for an expression statement
|
||||
(`site_at`/`item_site` only recurse into `DataDecl`/`PortDecl`/
|
||||
`ParamDecl`/`Typedef`/`Instantiation`/statement-declaration kinds — an
|
||||
`ExprStmt` is not one, confirmed by reading `stmt_site`, type_def.rs:311-343),
|
||||
so `type_definition` answers empty regardless of the fence. Re-run, passes.
|
||||
- Ambiguity convention vs. `nav::definition`'s: dev's `a_module_declared_twice_returns_both_declarations`
|
||||
goes through `Target::Module`'s `ExternalCandidate` path; QA's
|
||||
`indexed_type_returns_every_workspace_declaration_when_the_name_is_ambiguous`
|
||||
(type_def.rs:888) pins the same convention through the `indexed_type`/
|
||||
`NotFound` path specifically, which none of dev's tests touch. Verified
|
||||
by code reading that both really do share one convention, not two that
|
||||
happen to agree today: `indexed_type` and `resolve_external`
|
||||
(vlog_semantic/src/workspace.rs:382,413) both read
|
||||
`WorkspaceIndex::units(name)` (workspace.rs:105) — the same `BTreeMap`
|
||||
insertion order, "by file path, then by position in the file" per its
|
||||
own doc comment — so there is structurally one ordering, not a
|
||||
coincidence. Re-run, passes.
|
||||
- Package-of-same-name exclusion: dev's `a_package_of_the_same_name_is_not_a_type`
|
||||
(type_def.rs:695). Re-run, passes.
|
||||
- Function/instance/port name collisions: **not re-tested empirically —
|
||||
verified structurally impossible instead.** `indexed_type` only ever
|
||||
sees `ws.index().units(name)`, and `WorkspaceIndex::add_file` only
|
||||
inserts a name into `units` when `is_unit(kind)`
|
||||
(vlog_semantic/src/workspace.rs:206-219, `is_unit` at :288-293) is true,
|
||||
which is exactly `Module | Package | Typedef | Class`. A function, a
|
||||
task, a port, or an instance name can never appear in `units()` at all
|
||||
— there is no fence to test because there is no path for the collision
|
||||
to occur through. This is the same mechanism that makes the
|
||||
package-of-same-name test necessary in the first place (`Package` *is*
|
||||
a unit kind, which is why `indexed_type`'s own kind filter, not just
|
||||
`is_unit`, is needed for that one case).
|
||||
|
||||
**Finding (significant, corpus-derived) — the `NotFound`-only fence
|
||||
misses the single most common real-world shape.** `resolve.rs`'s `miss`
|
||||
(vlog_semantic/src/resolve.rs:190-201) resolves *any* lexical miss inside
|
||||
a class body carrying an `extends` clause as `Resolution::InheritedCandidate`,
|
||||
never `NotFound` — unconditionally, regardless of whether the missing name
|
||||
has anything to do with inheritance. `indexed_type` (type_def.rs:126-130)
|
||||
only fires on `NotFound`. Consequence: a cross-file interface or
|
||||
package-less class used as the type of *any* member of *any* class that
|
||||
extends something — which in practice is nearly every UVM class, since
|
||||
almost all of them extend `uvm_object`/`uvm_component`/etc. — falls
|
||||
through both layers and answers nothing, even though the interface or
|
||||
class in question is genuinely declared elsewhere in the workspace.
|
||||
Reproduced live on real corpus text: `corpus/ibex/dv/uvm/core_ibex/env/core_ibex_env_cfg.sv:5,7`
|
||||
(`class core_ibex_env_cfg extends uvm_object;` /
|
||||
`virtual clk_rst_if ibex_clk_vif;`) — `clk_rst_if.sv` is indexed
|
||||
(confirmed via `ws.index().units("clk_rst_if")`), the reference resolves
|
||||
to `InheritedCandidate { base: "uvm_object", .. }` rather than `NotFound`
|
||||
(confirmed via `reference_at`), and `type_definition` at that offset
|
||||
returns `[]`. Pinned as a portable (non-corpus) regression test,
|
||||
`a_class_scoped_type_reference_in_an_extending_class_is_never_found_cross_file`
|
||||
(type_def.rs:771), and reproduced again on the live corpus file in
|
||||
`corpus_spot_check_real_uvm_files_no_panic_and_known_jumps` (type_def.rs:1048).
|
||||
Not fixed here: widening the fence to also accept `InheritedCandidate`
|
||||
looks like the natural fix and is probably safe (the fence's other two
|
||||
conditions — file-scope declaration, `Module`/`Class`/`Typedef` kind only
|
||||
— still apply), but it is a production-logic change with its own shadow
|
||||
risk (a name that is genuinely an inherited member, not a type at all,
|
||||
coincidentally sharing a workspace type's name) that deserves its own
|
||||
design pass and tests rather than a QA drive-by fix. Recommend either
|
||||
widening `indexed_type`'s match at type_def.rs:128 to include
|
||||
`Resolution::InheritedCandidate { .. }`, or folding it into Handshake
|
||||
request 1 to `vlog_semantic`, whichever the dev prefers — either way this
|
||||
is the highest-value follow-up this feature has.
|
||||
|
||||
2. **Position→type-window mapping vs. `bind_data_type`** — verified clean.
|
||||
Array dims: `packed_and_unpacked_array_dimensions_do_not_confuse_the_type_match`
|
||||
(type_def.rs:992). Inline anonymous struct: `an_inline_anonymous_struct_has_no_type_name_to_jump_to`
|
||||
(type_def.rs:942) — both the declarator-name cursor and a cursor inside
|
||||
the inline body answer empty, not a bogus jump. Multiple declarators:
|
||||
`a_later_declarator_in_a_multi_declarator_line_still_finds_the_type`
|
||||
(type_def.rs:957). Parameter-typed decls: dev's
|
||||
`a_parameter_and_a_task_argument_are_typed_declarations_like_any_other`.
|
||||
`var`/`const` prefixes: `var_const_and_signed_qualifiers_do_not_shift_the_type_window`
|
||||
(type_def.rs:976). Function arguments (the task-argument case's twin):
|
||||
`a_function_arguments_type_is_reached_like_a_task_arguments` (type_def.rs:1004).
|
||||
All re-run/added, all pass.
|
||||
|
||||
3. **One-hop semantics + degenerate `typedef t t;` totality** — verified
|
||||
clean. Dev's `an_alias_chain_is_walked_one_hop_at_a_time` plus QA's
|
||||
`a_self_referential_typedef_is_total_and_does_not_loop` (type_def.rs:909),
|
||||
which checks every offset on `typedef t t;` answers promptly with no
|
||||
panic and no hang (there is no chain-following code path to loop in the
|
||||
first place — the one-hop design makes this total by construction, and
|
||||
the test pins that operationally). Re-run, passes.
|
||||
|
||||
4. **Delegation honesty** — verified clean, by code reading and by test.
|
||||
Every `Location` this module returns is built by `crate::locate::location`
|
||||
— `nav::definition`'s own answers (type_def.rs:58) and `indexed_type`'s
|
||||
fallback answers (type_def.rs:138) both call the same function imported
|
||||
at type_def.rs:45; there is no second, ad hoc `Location` construction
|
||||
anywhere in the file. `type_definition_on_a_type_name_agrees_exactly_with_definition`
|
||||
(type_def.rs:925) asserts literal equality with `nav::definition` at the
|
||||
same offset for the case where the two are supposed to coincide. Re-run,
|
||||
passes.
|
||||
|
||||
5. **Null conventions** — verified clean. Built-ins:
|
||||
`a_built_in_type_has_no_declaration_to_jump_to`. Unopened buffer:
|
||||
`a_buffer_the_server_does_not_hold_answers_nothing`. Position on no name:
|
||||
`a_position_on_no_name_at_all_answers_nothing`. Comment/whitespace cursor:
|
||||
`a_position_inside_a_comment_answers_nothing` (type_def.rs:1028). Past-EOF:
|
||||
`a_position_past_the_end_of_the_file_answers_nothing_not_a_panic`
|
||||
(type_def.rs:1021), offset = file length + 5000. All total (empty
|
||||
`Vec`, never a panic). Re-run, all pass.
|
||||
|
||||
6. **Both claimed parser gaps, reproduced directly against `vlog_parser::parse_source_tolerant`
|
||||
(temporary throwaway test, removed after use — not committed):**
|
||||
- `module m (bus_if bus, input logic clk);` → `Error(RawText)`,
|
||||
diagnostic `expected \`)\` (found "bus")` at the position right after
|
||||
`bus_if`. Confirms the first-port-direction-less claim exactly.
|
||||
- `module m (bus_if.mp bus);` (modport-qualified) → `Error(RawText)`,
|
||||
`expected \`)\` (found ".")`. Confirms the second claim in the same
|
||||
Handshake bullet.
|
||||
- `module m (my_pkg::state_t s);` (package-qualified) → `Error(RawText)`,
|
||||
`expected \`)\` (found "::")`. Confirms the third.
|
||||
Both Handshake requests in the feature README are accurate as written.
|
||||
|
||||
7. **CLAUDE.md compliance** — verified clean.
|
||||
- No `unwrap()`/`expect()`/`panic!` anywhere in `type_def.rs` outside
|
||||
`#[cfg(test)] mod tests` (checked by scanning the file up to that
|
||||
marker); `main.rs`/`server.rs`/`e2e.rs` diffs use them only inside test
|
||||
code, which CLAUDE.md permits.
|
||||
- `pub fn type_definition` and the newly-`pub(crate)` `nav::symbol_at`
|
||||
both carry doc comments; no other `pub` items were added.
|
||||
- README sections (Goal/Assumptions/Handshakes/Status/Work log/QA log/
|
||||
Review) each appear exactly once, in order.
|
||||
- `TODO.md`'s §9c item text is unchanged; only the checkbox flipped and a
|
||||
`→ delivered ...` annotation was appended in the file's existing,
|
||||
already-established style (18 other items use the same `→` convention;
|
||||
grepped to confirm this isn't a one-off).
|
||||
|
||||
**C. Corpus spot-check — completed; found and fixed a test-harness bug along
|
||||
the way, and found the significant `indexed_type` gap above.**
|
||||
|
||||
The interrupted run had left an `#[ignore]`d scratch test
|
||||
(`qa_scratch_corpus_spot_check`) that opened a **fresh `Workspace` and called
|
||||
`open_roots` (a full corpus re-index) for every one of ~400 small corpus
|
||||
files** in its panic-sweep loop. That made the test re-scan the whole
|
||||
`corpus/ibex` tree (651 files) once per small file — confirmed by running it:
|
||||
still not finished after 5.5 minutes of CPU time, killed rather than waited
|
||||
out. This was a test-harness bug, not a product one (`Workspace::set_document`
|
||||
only overlays a buffer against an index already built —
|
||||
`crates/lucisv_server/src/state.rs:175-179` — so the fix is to build the
|
||||
index once and reuse it). Rewrote it as
|
||||
`corpus_spot_check_real_uvm_files_no_panic_and_known_jumps` (type_def.rs:1048),
|
||||
un-ignored, now runs in ~2.6s:
|
||||
|
||||
- Full-file offset sweep (every byte offset, no `step_by`) over
|
||||
`dv/uvm/core_ibex/tb/core_ibex_tb_top.sv` (21 KB) and both
|
||||
`core_ibex_env_cfg.sv`/`core_ibex_scoreboard.sv` — no panic.
|
||||
- A genuine positive control on real corpus text: `clk_rst_if ibex_clk_if(...)`
|
||||
in `core_ibex_tb_top.sv` (a module-scope interface instantiation, not
|
||||
inside any class) jumps to exactly one location, in `clk_rst_if.sv` —
|
||||
confirming the happy path this feature claims works on code nobody wrote
|
||||
as a fixture.
|
||||
- The `indexed_type`/`InheritedCandidate` gap above, reproduced on the same
|
||||
real file it was found in (`clk_rst_if`, `core_ibex_dut_probe_if` — both
|
||||
real, indexed interfaces — answer empty inside `core_ibex_env_cfg`, which
|
||||
`extends uvm_object`).
|
||||
- `scrambling_key_agent_cfg` (dev/prior-run's negative probe) confirmed
|
||||
still empty, and confirmed *why*: that class is not vendored into this
|
||||
corpus checkout at all (`grep -rl "class scrambling_key_agent_cfg" corpus/ibex/`
|
||||
finds nothing), so empty is correct regardless of resolution kind — not a
|
||||
second instance of the gap.
|
||||
- 413 small `.sv`/`.svh` files under `corpus/ibex` (≤4000 bytes each),
|
||||
every third byte offset, sharing the one indexed workspace: no panic.
|
||||
|
||||
**D. Tests added this session** (on top of the 13 the interrupted run had
|
||||
already added and which are re-verified above): 1 —
|
||||
`a_class_scoped_type_reference_in_an_extending_class_is_never_found_cross_file`
|
||||
(type_def.rs:771) — plus the corpus test rewrite described in C. Total in
|
||||
`type_def.rs`: 38 (24 dev + 14 QA). `cargo test -p lucisv_server --bin
|
||||
lucisv-server type_def::` : 38 passed, 0 failed.
|
||||
|
||||
**Overall verdict:** not committable as-is. Every hard invariant, every gate,
|
||||
and six of the seven checklist attack surfaces are clean, and the feature's
|
||||
core design (offset redirection to `nav::definition`) is sound and exactly as
|
||||
documented. But the `indexed_type` fallback — the piece this feature added
|
||||
specifically to cover cross-file interfaces and classes — silently answers
|
||||
nothing for that exact case inside the single most common real-world
|
||||
container for it (any class with `extends`), which covers most UVM
|
||||
environment/agent/scoreboard/sequence classes in practice. That is a
|
||||
functional gap in the feature's own headline claim, not a cosmetic one, and
|
||||
it was findable only by running on real code, not by the crafted unit tests
|
||||
(hence being caught here rather than in dev's own suite). Recommend: dev
|
||||
either widens the `indexed_type` fence to accept `InheritedCandidate` (with
|
||||
its own shadow-risk tests) or files it as a second, explicit Handshake
|
||||
request to `vlog_semantic`; either way, one more QA pass over just that
|
||||
change before this ships. Nothing else found blocks a commit.
|
||||
|
||||
### 2026-08-26 — QA agent (fix-round re-verification)
|
||||
|
||||
Scoped to the fix only, per the lead's brief: not a redo of the original
|
||||
checklist above, all of which stands.
|
||||
|
||||
**A. Gates — re-run from a clean state, all green:**
|
||||
|
||||
- `cargo fmt --all -- --check`: clean.
|
||||
- `cargo clippy --all-targets --workspace`: 0 warnings.
|
||||
- `cargo test --workspace`: green throughout — 748 passed / 4 ignored in
|
||||
`lucisv_server`'s own suite before any QA changes (matching dev's claim
|
||||
exactly), 750 passed / 4 ignored after adding the two tests below, 0 failed
|
||||
anywhere in the workspace at every step.
|
||||
- `cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`:
|
||||
`smoke: OK`.
|
||||
|
||||
**B. Diff minimality — confirmed by mtime, since neither changed file has any
|
||||
commit history to `git diff` against (both are still untracked; this feature
|
||||
has never been committed).** `type_def.rs` and this README were last written
|
||||
at 15:12 and 15:14 respectively; every other file the original round touched
|
||||
(`main.rs`, `nav.rs`, `server.rs`, `tests/e2e.rs`, `TODO.md`,
|
||||
`docs/features/lucisv-server/README.md`) was last written between 14:19 and
|
||||
14:30 — nearly 45 minutes earlier, before the fix round started. Consistent
|
||||
with dev's claim that the fix round touched only `type_def.rs` (one match
|
||||
arm, its doc comment, the test module) and this README. Not a substitute for
|
||||
a real diff, but the strongest signal available without one.
|
||||
|
||||
**C. The three precedence citations — read directly, all accurate:**
|
||||
|
||||
- `resolve.rs::lexical` (`crates/vlog_semantic/src/resolve.rs:39-70`): walks
|
||||
`scope.parent` only (line 67); no reference to a base class's scope
|
||||
anywhere in the function. Confirmed.
|
||||
- `resolve.rs::miss` (`:201-213`): for a non-unit miss, returns
|
||||
`InheritedCandidate { base, external }` when `nearest_extends` finds one
|
||||
(line 206) — the base's *name* only, never chased — and only falls through
|
||||
to `NotFound`/`ExternalCandidate` otherwise. Confirmed.
|
||||
- `workspace.rs::resolve_external` (`:382-391`): `let Resolution::ExternalCandidate { paths } = &reference.resolution else { continue };` —
|
||||
an `InheritedCandidate` (or `NotFound`) is skipped outright, never handed to
|
||||
`follow_paths`. Confirmed.
|
||||
|
||||
Together these close the precedence question exactly as claimed: no path in
|
||||
`vlog_semantic` today can turn an `InheritedCandidate` into a `Location`, so
|
||||
the widened fence only ever fires where `nav::definition` already came back
|
||||
empty (`type_def.rs:58-63`, also read and confirmed).
|
||||
|
||||
**D. Fence re-attack.**
|
||||
|
||||
1. **Original shadowing counterexamples, re-run:** all still pass —
|
||||
`a_local_declaration_of_the_same_name_wins_over_the_workspace_type`,
|
||||
`a_plain_expression_use_of_a_workspace_module_name_is_never_a_type_site`,
|
||||
`a_package_of_the_same_name_is_not_a_type`,
|
||||
`indexed_type_returns_every_workspace_declaration_when_the_name_is_ambiguous`.
|
||||
Untouched by the fix, verified by reading them, not just by the green
|
||||
suite.
|
||||
2. **New: a local typedef of the same name inside the *extending* class's own
|
||||
body (as opposed to dev's test, which puts it in the *base*).** Added
|
||||
`a_local_typedef_in_the_extending_class_itself_wins_over_the_workspace_type`
|
||||
(`type_def.rs`, QA fix-round section) — `class top extends base; typedef
|
||||
int bus_if; bus_if h; endclass` alongside a workspace interface also named
|
||||
`bus_if`. Confirmed `Resolved` (not `InheritedCandidate`) and the jump
|
||||
lands on the in-file typedef, never the workspace interface — `lexical`'s
|
||||
own-scope lookup (resolve.rs:44) wins before `miss` ever runs, so the
|
||||
widened fence is not even consulted here. Passes.
|
||||
3. **New: an `InheritedCandidate` in a type window matching a workspace
|
||||
MODULE.** Added
|
||||
`an_inherited_candidate_reaches_a_same_named_module_exactly_like_not_found_did`
|
||||
— a member of an extending class typed as a name that is only a workspace
|
||||
*module*. Resolution is `InheritedCandidate` as expected, and the fence's
|
||||
kind filter (`Module | Class | Typedef`, unconditioned on which resolution
|
||||
triggered it) lets it through exactly as it already would for `NotFound` —
|
||||
confirmed both by this new pinned test and by re-reading `indexed_type`
|
||||
(type_def.rs:136-148), which never branches on *which* of the two
|
||||
resolutions matched. Passes; now pinned permanently.
|
||||
4. **`pkg::t` qualified references — mostly unaffected, but not entirely, and
|
||||
this predates the fix.** Verified by two throwaway probes (not committed —
|
||||
removed after use, per the convention the last QA round set). The common
|
||||
case dev's claim describes is correct: when the qualifying unit is not
|
||||
declared in this file at all, the reference is `ExternalCandidate`
|
||||
(`a_qualified_name_the_overlay_refused_is_not_retried_against_the_index`
|
||||
already pins this). But `resolve.rs::unit_member` (`:121-166`) has its own,
|
||||
separate miss path via `Target::UnitMember`: when the unit *is* found
|
||||
locally — a `Class` with `extends` whose own scope lacks the member, or a
|
||||
`Package`/extends-less `Class` whose own scope lacks the member — the
|
||||
member reference resolves to `InheritedCandidate` or plain `NotFound`
|
||||
respectively, exactly the two spellings `indexed_type` matches on.
|
||||
`indexed_type` does not look at which `Target` produced the resolution; it
|
||||
takes the *bare* member name and searches the whole workspace unit table
|
||||
with it, discarding the qualifier entirely. Reproduced concretely: with
|
||||
`class base; endclass class top extends base; endclass` and `module m; top::ambiguous_member x; endmodule`,
|
||||
plus an unrelated `class ambiguous_member` in another file, the reference
|
||||
resolves to `InheritedCandidate` and `type_definition` jumps straight to
|
||||
the unrelated decoy — nothing about `top` or its `base` chain was ever
|
||||
consulted. **This is not new or introduced by this fix round**: the control
|
||||
probe swaps `top extends base` for a plain `package local_pkg; endpackage`
|
||||
(so the miss is a bare `unit_member` `NotFound`, the resolution this
|
||||
feature's fence has matched since the original round) and reproduces the
|
||||
identical bare-name jump to the same kind of decoy. So the widening did not
|
||||
create this gap — it already existed for `NotFound`-via-`Target::UnitMember`
|
||||
and was implicitly accepted (or simply not probed) in the original QA
|
||||
round, which tested `Target::Lexical`-produced misses and one
|
||||
`Target::Unit` ambiguity case, but no `Target::UnitMember` miss on a
|
||||
*locally* resolved unit. Not filed as a blocking finding against this fix
|
||||
round — it is orthogonal to what changed here — but worth a follow-up: the
|
||||
fence's bare-name lookup is only sound for a `Target::Lexical` miss (where
|
||||
the bare name really is "does the workspace declare this anywhere");
|
||||
applying it to a `Target::UnitMember` miss answers a question the
|
||||
qualifier already narrowed and can jump to a declaration with no
|
||||
relationship to the qualifying unit. Recommend a design pass on
|
||||
`indexed_type` to check the reference's target kind (or otherwise confine
|
||||
the fence to unqualified names) the next time this file is touched.
|
||||
|
||||
**E. Corpus spot-check — stable across 3 consecutive runs**, ~2.7s each,
|
||||
`checked 413 small corpus files, no panic` every time, both now-positive
|
||||
assertions (`clk_rst_if`, `core_ibex_dut_probe_if`) holding every run.
|
||||
Fixture reasoning independently confirmed: `corpus/ibex/dv/uvm/core_ibex/env/core_ibex_dut_probe_if.sv`
|
||||
and `corpus/ibex/vendor/lowrisc_ip/dv/sv/common_ifs/clk_rst_if.sv` both exist
|
||||
in this checkout exactly where the test expects them. Not brittle by any
|
||||
signal found this session.
|
||||
|
||||
**F. Tests added this session:** 2, both permanent —
|
||||
`a_local_typedef_in_the_extending_class_itself_wins_over_the_workspace_type`
|
||||
and `an_inherited_candidate_reaches_a_same_named_module_exactly_like_not_found_did`.
|
||||
Total in `type_def.rs`: 44 (42 + 2 QA). Two additional throwaway probes used
|
||||
to investigate item D.4 above were removed after confirming the finding, per
|
||||
the standing convention (not committed).
|
||||
|
||||
**Overall verdict: committable.** The fix is exactly what it claims to be —
|
||||
one match arm widened, nothing else in production code touched, confirmed by
|
||||
mtime and by reading the file in full. The three precedence citations hold up
|
||||
under independent reading. All of the previous QA round's attack surfaces
|
||||
still pass unchanged. Two new attack angles the brief asked for (local
|
||||
same-class shadowing, module-kind parity) are now pinned permanently and both
|
||||
pass. The corpus regression this fix was written for is confirmed fixed and
|
||||
stable. One new, non-blocking finding (D.4 above) is pre-existing scope, not
|
||||
a regression from this round, and is written up for a future pass rather than
|
||||
held against this one.
|
||||
|
||||
## Review
|
||||
|
||||
### 2026-08-26 — lead
|
||||
|
||||
Reviewed the diff, the work log and both QA rounds' logs; re-ran all
|
||||
gates myself, clean. This round earned its fix cycle. The core design —
|
||||
type-definition as one redirection into `nav::definition`, so locations
|
||||
are only ever built by one code path — is exactly right, and the module
|
||||
doc explains it well enough to maintain. The original QA round's
|
||||
rejection was correct and well-evidenced: the fallback built for
|
||||
cross-file interfaces missed them inside every extending class, found on
|
||||
a real Ibex file by the corpus sweep. The fix round's widening is sound
|
||||
because its safety argument was *derived* — three independent citations
|
||||
in vlog_semantic proving no layer can turn an InheritedCandidate into a
|
||||
location today — and the precedence story costs no code by construction.
|
||||
|
||||
One lead addition before commit: QA's follow-up probe showed a qualified
|
||||
member miss (`pkg::missing_t` against a local package) reaches the
|
||||
fallback with the same two resolution spellings, and the bare-name sweep
|
||||
would then discard the qualifier — a wrong jump, which this feature's
|
||||
own doc comment says is worse than an empty answer. I added the
|
||||
qualifier guard in `indexed_type` (decline when the text before the
|
||||
reference ends with `::`), with a pinning test proven by deliberate
|
||||
breakage (fails with the guard disabled, passes with it). The
|
||||
vlog_semantic Handshake stays filed covering both miss spellings; when
|
||||
it lands, `indexed_type` — guard and all — is deleted whole. QA process
|
||||
note: the first QA agent was lost to an infrastructure error mid-run;
|
||||
the resumed agent picked up its uncommitted work, finished the sweep,
|
||||
and found the rejection-worthy bug in the step the first run never
|
||||
reached. Accepted as shipped.
|
||||
Reference in new issue
Block a user