# class-semantics ## Goal Classes become first-class in `vlog_semantic`. The classes round (`docs/features/classes/README.md`) made class declarations parse and format, but filed the honest gap: *"no name declared inside a class body is indexed, hovered or navigable"* — a real LSP hole across the entire DV half of the corpus. This feature closes it: class declarations bind a `SymbolKind::Class` symbol and open a `ScopeKind::Class` scope; properties, methods, parameters, typedefs and nested classes bind inside it; references in method bodies resolve through the class scope chain; `extends`, `this.x`, `super.x`, static `cls::x` access and out-of-body `function void cls::method(...)` definitions all get honest resolutions; and the workspace index gains classes as units with their exported members, so cross-file `extends Base` resolves. ## Resolution rules as shipped Numbered so the next round can cite them. LRM-informed, corpus-tempered — the deviations are stated where they happen. 1. **Binding.** `class c` binds a `Class` symbol in the enclosing scope and opens a `Class` scope. Header `#( ... )` parameters bind as `Param` in the class scope, exactly like module header parameters. Properties bind through the ordinary declarator path (`Var`, or `Net` for the never-seen net-typed member); `rand`/`static`/`local`/... qualifiers are irrelevant to binding. Methods bind as `Function`/`Task` with their own scopes and `TfArg`s; a prototype (`extern ...;`, `pure virtual ...;`) binds exactly like a full method with an empty body. Class-body typedefs, localparams, imports, enums (variants land in the class scope, per the same LRM rule as modules) and nested classes all ride the existing item walk — a class body is an item list, so no per-kind code was added. 2. **Verbatim members stay opaque.** `constraint c { ... }` and `covergroup ... endgroup` are `ItemKind::Verbatim` leaves; no symbol is bound for a constraint or covergroup name and nothing inside one is scanned. Same contract as macro invocations and directives. 3. **Lexical resolution.** A bare name in a method body walks the ordinary chain: method scope → class scope → enclosing (package/module/file), imports consulted per scope as everywhere else. *Deliberate LRM inexactness:* the LRM puts inherited members ahead of enclosing scopes; lucisv cannot see into a base class it does not model, so the full lexical chain is searched first and inheritance is the fallback. An in-file name therefore always wins over a hypothetical inherited one. 4. **Inheritance is never chased — not even in-file.** `extends Base` itself is resolved as a reference (rule 5). But a member use that misses the whole lexical chain, written inside a class whose nearest extends-carrying enclosing class says `extends Base`, becomes `Resolution::InheritedCandidate { base, paths }` — `base` is the extends path as written (`uvm_component`, `pkg::base`), `paths` are the import paths the lexical walk collected on the way out (both could supply the name; recording both is the honest answer). Nothing chases `base`, in this file or out of it: a future hover/index round can, without this crate pretending it did inheritance resolution. The fallback applies to *member* uses only — a **unit-name** miss (a `p::x` head, an `extends`/`implements` base) stays `ExternalCandidate` even inside an extending class, because a base class supplies members, not package or class names (QA-found, lead-ruled; pinned by `a_unit_miss_inside_an_extending_class_stays_external_a_member_miss_does_not`). **Non-goals, stated:** no method-resolution-order, no override checking, no base-member lookup. 5. **`extends Base` resolves as a unit reference** from the class's *enclosing* scope: the lexical chain is walked for a symbol of a unit kind (`Class`, `Package`, `Typedef` — the last so `typedef class c;` forward declarations answer), non-unit shadowers are skipped, and on a miss the reference is `ExternalCandidate` carrying every import path in the chain that could supply the name plus the bare name itself — so `import uvm_pkg::*; class c extends uvm_object;` offers `["uvm_pkg::*", "uvm_object"]` to the workspace. A scope-qualified base (`extends pkg::base`) records two references, head and tail, like `p::x` everywhere else; middle segments of a 3-deep chain are not recorded (none in the corpus). 6. **`extends` parameter overrides** (`#(.W(8))`): `.W` resolves against the base class's scope when the base is in this file (its header params are ordinary class-scope symbols), else `ExternalCandidate { ["base::W"] }` — the last path segment names the unit, so the workspace member table answers it. Override *values* bind in the class's own scope: the LRM allows `extends base #(.W(W))` to reference the class's own parameters, and the corpus does it. 7. **`this.x`** resolves `x` in the nearest enclosing class's scope only — a member access cannot name a method local or an enclosing module net. Miss → `InheritedCandidate { base }` when that class extends, else `NotFound`. **`super.x`** always records against the base, like an inheritance miss: `InheritedCandidate { base }` when the class extends, `NotFound` when it does not (super without a base is illegal anyway) — including `super.new(...)`. `this`, `super`, `null` and bare `new` are never recorded as plain uses: they are reserved words whose referent this crate either models specially (this/super) or cannot know without types (`new` names the constructor of the *assigned* class). 8. **Static access `cls::x`.** The head of any `p::x` — expression or type position — is now a *unit* lookup (rule 5's walk), so it finds classes and packages alike, lexically, wherever they are declared (a class nested in an in-file package included). The tail is looked up in the unit's scope only: found → resolved; package miss → `NotFound` (the long-standing rule 6 of the vlog-semantic README: no index can change the answer); class miss → `InheritedCandidate { base }` when that class extends (a static member may be inherited), else `NotFound`; unit not in this file → `ExternalCandidate { ["cls::x"] }`. `import p::x` heads still resolve as packages only — only a package can be imported. 9. **Out-of-body definitions** (`function void cls::method(...)`) are *deferred*: the whole file binds first, then each deferred method looks up `cls` (unit-kind lexical walk from the writing scope, descending through `::` segments) and binds the method symbol **into cls's scope**. When the extern prototype already declared the name there, the definition-site name becomes a *reference* to the prototype — the same redeclaration-becomes-reference rule non-ANSI ports use — so definition/references round-trip across the two sites. The body's scope hangs under cls's scope, so properties and params resolve from the body; the scope is marked as owned by the prototype symbol so method locals do not spill into the class outline. A reference is recorded for the `cls` segment itself (navigation to the class); when `cls` is not declared in this file the method binds in the writing scope instead and the `cls` reference becomes an external candidate. 10. **Queries just work, zero API changes.** `definition_of`, `references_of`, `document_symbols` (classes nest their members; method bodies nest under methods), hover data and `workspace_symbols` all operate on class members through the existing code paths. ## Workspace index additions (all additive) - Classes at file scope are **units**: `units("c")` returns them, `workspace_symbols` lists them, and a cross-file `extends Base` resolves through `follow_one`'s existing bare-name arm. - Class members (params, typedefs, enum variants, functions, tasks, vars, nets, nested classes) are **exported members**, and packages now also export the classes declared in them — so `import uvm_pkg::*` can answer `uvm_object` when the workspace holds it. - Member registration recurses through nested classes: a class inside a package (the dominant UVM shape) gets its members registered under the *class's* name, so an external `cls::x` candidate (`member("cls", "x")`) answers even though the class is not a file-scope unit. - `IndexCounts` gains a `classes` field (additive; all existing fields unchanged). - `resolve_external` does **not** chase `InheritedCandidate` — that is the documented future round, and the variant exists precisely so the index can do it without re-deriving anything. ## scan.rs status Class binding introduces **zero** new `scan.rs` usage: every class-round AST node carries a parser `name_span` (the name-spans convention), and this round also completed the migration that feature left to us — module, package, function, task, genvar, import, foreach, typedef, declarator, enum member, instance, module-name, connection, gate-instance and block-label spans now come from the parser, and `typedef_name_span` / `decl_name` are deleted. `scan.rs` itself survives with exactly **two** consumers, both documented: 1. `bind_data_type` — a `DataType` has no span (vlog-semantic handshake item 2, still open with `vlog_parser`); the type-name window scan stays until it lands. 2. `StmtKind::Disable` — deliberately given no span by name-spans (a use, not a declaration), so `name_after_kw` stays for it. So the stretch goal (delete scan.rs) is **not** met, and honestly cannot be until handshake item 2 lands; the module is now ~40 lines of live use instead of the whole declaration surface. `Instantiation.module_span` has the documented despace caveat (`pkg :: mod`), so it is taken only when it slices back to the stored name exactly (`exact_or_empty`), preserving the "exact or empty" span contract and the corpus 0-unplaced assertion. ## Assumptions - **Class scopes are ordinary lexical scopes for bare names.** The LRM restricts a nested class's access to its outer class's instance members; lucisv does not distinguish static from instance access and lets the chain through. More permissive, never corrupting, same argument as forward references everywhere. - **The nearest enclosing extends-carrying class supplies `base` for an inheritance miss**, even when the innermost class has no `extends` of its own. A nested class does not truly inherit its outer class's base; the corpus never nests a class inside an extending class, and the fallback only fires after the entire lexical chain already missed. - **`FunctionDecl::scope` / `TaskDecl::scope` and `ClassExtends::name` may glue `::` chains** whose source spelled spaces around the `::`. Every span derived from them is verified by slicing (`exact_or_empty` / skip-if-inexact), so a spaced spelling costs a reference, never a wrong span. - **`new` binds as a declaration** (`function new` is an ordinary `Function` symbol named `new`) but is never recorded as a use (rule 7). - The corpus test's populations shift: files with classes now contribute symbols and references they did not before, so the baseline table below is the honest new baseline, not comparable line-by-line with the old one beyond the stated before/after. ## Handshakes **Consumed from `vlog_parser`** (no change requested): `ClassDecl`, `ClassExtends`, `Name`, `ImportPath`, `TypedefKind::ForwardClass`, `FunctionDecl`/`TaskDecl` `prefix`/`is_prototype`/`scope`, and every `name_span`/`label_span`/`module_span` the name-spans round added. Handshake item 2 (a `DataType` span) **remains open** — it is now the only thing keeping `scan.rs` alive (with the deliberate `Disable` exception). **Promised to consumers** (additive, nothing renamed or removed): - `SymbolKind::Class`, `ScopeKind::Class`, `Resolution::InheritedCandidate { base, paths }`, `Reference::is_inherited_candidate()`, `IndexCounts::classes`. - `analyze` still never panics or fails; every non-empty `name_span` still slices back to exactly the name (corpus-asserted, 0 unplaced). - `ExternalCandidate` semantics unchanged; `InheritedCandidate` is a new, third honest answer the workspace overlay currently leaves untouched. **Compile-fixes outside this feature's scope, listed per the name-spans precedent** (`SymbolKind` is matched exhaustively downstream, so the new variant does not compile without them; each is one arm, no logic): - `crates/lucisv_server/src/tokens.rs` — `SymbolKind::Class => Highlight::Class` in `symbol_type`. - `crates/lucisv_server/src/symbols.rs` — `SymbolKind::Class => "class"` in `kind_label`, `SymbolKind::Class => LspKind::CLASS` in `lsp_kind`. **Requested of a future round (not done here):** chasing `InheritedCandidate` — in-file via `Semantics`, cross-file via the workspace member table (`member(base_tail, name)` is already the right lookup); and hover text for "class c extends base". ## Corpus acceptance `cargo test -p vlog_semantic --test corpus -- --nocapture`, same 860-file corpus, before → after this feature (both measured this round, same tree otherwise): | population | | symbols | references | resolved in-file | external | inherited | unresolved | unplaced | |---|---|---:|---:|---:|---:|---:|---:|---:| | every file (860) | before | 21 243 | 71 938 | 76.3 % | 20.6 % | — | 3.1 % | 0 | | every file (860) | **after** | **25 475** | **88 569** | **72.1 %** | **17.8 %** | **7.6 %** | **2.5 %** | **0** | | clean files (671) | before | 15 202 | 56 220 | 78.3 % | 20.5 % | — | 1.3 % | 0 | | clean files (671) | **after** | **17 760** | **67 646** | **74.0 %** | **17.9 %** | **7.1 %** | **1.0 %** | **0** | (The after rows include the 2026-08-20 QA fix: 198 clean-file / 359 all-file unit-name misses moved from the inherited bucket back to the external bucket, where rules 5/8 always said they belonged.) Reading it honestly: - **+4 232 symbols and +16 631 references** (+2 558 / +11 426 on clean files) — the DV half of the corpus becoming navigable. That is the feature. - **The in-file rate drops** (78.3 % → 74.0 % clean), exactly as predicted: class code references UVM externals heavily. The drop is not lost resolution — the old denominator simply excluded every name inside a class. 7.1 % of all clean-file references are now `InheritedCandidate` (uses only a base class — almost always `uvm_pkg` machinery not in the corpus — could supply), reported as their own honest bucket, and the external-candidate share *fell* (20.5 % → 17.9 %) because many former wildcard-import candidates inside classes are now inherited candidates carrying those same paths. - **Unresolved *fell* too** (1.3 % → 1.0 % clean, 3.1 % → 2.5 % all): the this/super/null/new suppression removed noise, and names that used to dangle in class-bearing files now bind. - 0 panics, 0 unplaced names across 114 044 spans, both populations. Workspace index over the same corpus (`cargo test -p vlog_semantic --test workspace -- --nocapture`): `530 modules, 63 packages, 31 file-scope typedefs, 246 classes, 11 399 exported members` (9 202 members before — class members and package-exported classes are the growth), build ~0.8 s, determinism assertions green. The overlay now sees 12 111 clean-file external candidates and answers **11 009 (90.9 %)** — before the QA fix it saw 11 913 and answered 10 839, so the fix handed the index 198 more candidates and it answered **170** of them, exactly the navigation QA measured as lost; the *rate* dips 0.1 pt only because the other 28 name units the corpus genuinely lacks. Against the pre-feature baseline (92.5 %) the remaining movement is population change: class code contributes candidates for units like `uvm_pkg` that no index over this corpus can answer. After-overlay unresolved-external rate: **1.6 %** of all clean-file references (1.5 % before, on the smaller pre-class denominator). The top misses are unchanged and all genuinely absent sources (`sail_ibexspec`, `SB_SPRAM256KA`, `PLLE2_ADV`, `uvm_pkg`). ## Status / TODO - [x] `SymbolKind::Class`, `ScopeKind::Class`, `Scope::extends` (crate- private), `Resolution::InheritedCandidate { base, paths }` - [x] `bind_class`: class symbol + scope, header params, extends refs + overrides, implements refs, body via the ordinary item walk - [x] this/super member targets; this/super/null/new never plain uses - [x] `Target::Unit` / `Target::UnitMember` (heads of `p::x` find classes; package behavior byte-identical); `Target::ThisMember` / `Target::SuperMember` - [x] Inheritance-miss shape: `InheritedCandidate` from the lexical walk, never chased - [x] Out-of-body methods deferred, bound into the class scope, prototype round-trip via redeclaration-becomes-reference - [x] bind.rs migrated off `scan.rs` for every parser-supplied span; `scan.rs` down to `bind_data_type` + `Disable` (documented) - [x] Workspace: classes as units, class members + package-exported classes + nested-class recursion, `IndexCounts::classes` - [x] Corpus test reports the external/inherited breakdown (assertions kept: 0 unplaced, < 3 % unresolved on clean files) - [x] 25 new behavior tests (`tests/classes.rs` — 23 from the dev round, plus the QA-fix pin for unit-vs-member misses and the permanent package-tail-miss `NotFound` pin); existing 46 green — corpus.rs reporting extended (inherited bucket + counter), the workspace corpus report prints the classes count, no existing assertion weakened or removed - [x] TODO.md §6 annotation; classes README handshake annotated delivered - [ ] Future round: chase `InheritedCandidate` (in-file + workspace); hover "extends base" - [ ] Still blocked on parser handshake item 2: delete `scan.rs` ## Work log **2026-08-19 — dev agent.** Read CLAUDE.md, the vlog-semantic, classes, workspace-index and name-spans READMEs, and the five source files before touching anything. Baseline recorded first (test counts, corpus numbers — the "before" rows above). Key decisions: - **`InheritedCandidate { base, paths }`, not just `{ base }`.** The task sketched `{ base }`; the walk already holds the import paths it collected when the miss happens, and dropping them would erase real candidates — `import uvm_pkg::*` and `extends uvm_component` can *both* supply `get_name`. Carrying both is the honest shape and costs a Vec that was already built. - **Full lexical chain before inheritance** (rule 3's stated LRM inexactness). The alternative — stopping at the class boundary because an invisible base *might* define the name — would turn every resolvable enclosing-scope reference in DV code into a guess. In-file facts win. - **Deferred binding for out-of-body methods.** Pass one cannot look up `cls` (it may not be bound yet — forward references are the point of the two-pass design), so out-of-body methods are collected during the walk and bound after it, when every class scope exists. This required the binder to borrow the tree (`Binder<'a>` now ties `src` and the item refs to one lifetime) — mechanical, no behavioral change elsewhere. - **The out-of-body body scope is marked owned by the prototype symbol** (without touching the prototype's own `child_scope`), purely so `document_symbols` does not spill method locals into the class outline — found by the nesting test, not predicted. - **Migrated bind.rs off scan.rs while in there.** The task required only "no new scan usage", but routing class names through parser spans while module names still went through the scanner would have left the crate half-and-half; the name-spans README explicitly left this migration "to vlog_semantic's next round", which is this one. `exact_or_empty` guards the one despace-caveat field (`module_span`). Corpus: 0 unplaced before, 0 after, +20 863 spans. - **`Target::Package` kept for import heads** — only a package can be imported — while expression/type heads widened to `Target::Unit`. The existing package tests pass unmodified because the lexical unit walk finds file-scope packages exactly where `named_at_file_scope` did, and skips non-unit shadowers on the way. - **corpus.rs gained the inherited bucket.** Unavoidable: `InheritedCandidate` would otherwise count as "unresolved" and trip the < 3 % assertion the moment class files joined the clean population — the bucket is a new honest category, not a relaxation; both original assertions (0 unplaced, < 3 % unresolved on clean files) stand unweakened. - Ran the semantics suite, the full workspace suite, clippy and fmt at the end; exact results in the Status section and the final report. **Checks at the end:** `cargo test -p vlog_semantic`: 69 passed, 0 failed (6 scan unit + 1 corpus + 19 semantics + 20 workspace + 23 classes). `cargo clippy --workspace --all-targets`: silent, 0 warnings. `cargo fmt --all -- --check`: clean. `cargo test --workspace`: **825 passed, 0 failed** (summed over every `test result:` line). Corpus and workspace-index numbers above are from the final tree. **2026-08-20 — dev agent, post-QA fix (lead-ruled).** Applied the QA log's LOW should-fix: a *unit-name* miss inside an extending class now stays `ExternalCandidate`, per rules 5/8 — a base class supplies members, not package or class names. Of the two offered fixes, took the first (honor the unit-lookup flag *before* the `nearest_extends` consult in `resolve.rs`'s `miss`, parameter renamed `always_external` → `unit_lookup` and the doc comment now states the ruling); member misses route to `InheritedCandidate` exactly as before. Also added the QA-recommended permanent pin for the package-tail-miss `NotFound` rule (it had only ever lived in deleted scratch suites). Two new tests in `classes.rs`: `a_unit_miss_inside_an_extending_class_stays_external_a_member_miss_does_not` (QA's exact repro, both shapes: a `p::x` head and a nested class's own `extends` base, plus the member-miss counterexample) and `a_missing_member_of_an_in_file_package_is_not_found` (from a module *and* from inside an extending class, so the extends fallback can never leak into the package arm again). Measured effect (probe with exact counts, before → after the fix): clean files 11 913 → 12 111 external candidates (+198, inherited 4 980 → 4 782), overlay answered 10 839 → **11 009** (+170 — exactly the references QA measured as lost navigation; the answered *rate* dips 91.0 % → 90.9 % because all 198 join the denominator and the other 28 name units the corpus lacks). Every file: 15 433 → 15 792 external (+359, inherited 7 057 → 6 698), answered 13 337 → 13 658 (+321). Resolved-in-file, unresolved and unplaced unchanged in every digit (74.0 % / 1.0 % / 0 clean; 72.1 % / 2.5 % / 0 all). The measurement briefly reverted `miss` in the working tree to capture the "before" run; the fixed file was restored from a copy and byte-verified (`cmp`) before the final gates. Checks after the fix: `cargo test -p vlog_semantic` **71 passed, 0 failed** (6 + 1 + 19 + 20 + 25); `cargo test --workspace` **827 passed, 0 failed**; `cargo clippy --workspace --all-targets` 0 warnings; `cargo fmt -p vlog_semantic -- --check` clean. Rule-4/5 prose and the acceptance tables above updated to the post-fix numbers. ## QA log **2026-08-20 — QA agent.** Read CLAUDE.md, this README, the vlog-semantic README (rule 6, the pinned package-tail-miss rule) and the full diff of `model.rs` / `resolve.rs` / `bind.rs` / `lib.rs` / `workspace.rs` / `tests/{classes,corpus,workspace}.rs` and the three `lucisv_server` arms. Attacks ran as a 29-test scratch suite (`tests/qa_probe.rs`, deleted after the run) plus a baseline `git worktree` at `da1448e` used to re-measure the "before" rows independently. Scope was held to `-p vlog_semantic -p lucisv_server`; nothing outside this feature was touched. **Gates re-run on the current tree.** `cargo test -p vlog_semantic`: **69 passed, 0 failed** (6 lib + 23 classes + 1 corpus + 19 semantics + 20 workspace) — the claimed split is exact. `cargo test -p lucisv_server`: 122 passed (116 unit + 6 e2e), no test file modified. `cargo clippy -p vlog_semantic -p lucisv_server --all-targets`: **0 warnings**; the crates carry exactly one new `#[allow]` (`bind.rs:694`, `too_many_arguments`) and it is commented. `cargo fmt -p vlog_semantic -p lucisv_server -- --check`: clean. `cargo test --workspace`: **825 passed, 0 failed** (summed over 28 `test result:` lines), reproducing the work log's number. **Corpus, measured twice — byte-identical output both runs.** Every cell of the acceptance table reproduces exactly, and the "before" rows were re-measured in a clean worktree at `da1448e` rather than taken on trust: | population | | symbols | references | resolved | external | inherited | unresolved | unplaced | |---|---|---:|---:|---:|---:|---:|---:|---:| | all (860) | before (re-measured) | 21 243 | 71 938 | 76.3 % | 20.6 % | — | 3.1 % | 0 | | all (860) | after | 25 475 | 88 569 | 72.1 % | 17.4 % | 8.0 % | 2.5 % | 0 | | clean (671) | before (re-measured) | 15 202 | 56 220 | 78.3 % | 20.5 % | — | 1.3 % | 0 | | clean (671) | after | 17 760 | 67 646 | 74.0 % | 17.6 % | 7.4 % | 1.0 % | 0 | 0 panics, 0 unplaced over 114 044 spans (25 475 + 88 569). Workspace index reproduces too: 860 files in 0.77 s, 530 modules / 63 packages / 31 file-scope typedefs / **246 classes** / **11 399 members** / 502 defines (baseline: 9 202 members, no class count), determinism assertions green, clean-file overlay **91.0 %** answered and **1.6 %** after-overlay external (baseline **92.5 %** / **1.5 %**). **The 92.5 % → 91.0 % explanation is correct — verified, not accepted.** Re-ran the overlay over the population that did *not* change (clean files containing no `class` keyword), in both trees: - before: 529 files, 56 084 refs, 11 475 external candidates, 10 637 answered = **92.7 %** - after: 56 063 refs, 11 460 external candidates, 10 640 answered = **92.8 %** Flat. The whole move comes from class-bearing clean files, which went from 136 to 11 583 recorded references; their ~453 external candidates answer at ~44 % because they name `uvm_pkg` and friends the corpus genuinely lacks. The README's population-change wording is accurate. **The `unresolved()` redefinition in `corpus.rs` is not a relaxation.** Both original assertions are textually intact (`all.unplaced == 0`, `100 * clean.unresolved() < 3 * clean.references`). The new bucket could only weaken the second if it absorbed misses from the pre-class population; it does not — over all 860 files, of 7 057 inherited candidates, **0** come from a file with no `class` keyword in it (probe q20). Inherited candidates are structurally reachable only under a `ScopeKind::Class` chain. **Verified by attack (all green).** - *Claim 2's crux.* An in-file base that really declares the member still yields `InheritedCandidate { base }`, never a resolution — for a property and for a method, with and without a competing wildcard import (q1, q4). A 3-level in-file chain `c extends b extends a` blames only `b` for both `from_a` and `from_b`: no chasing at any level (q2). Matches rules 3–4, which state the LRM inexactness as deliberate. - *UVM shape.* `import uvm_pkg::*; import my_pkg::*; class d extends uvm_component` — a miss carries the base **and** both paths in walk order (q3). - *this/super.* `this.x` is nearest-class-only even against an *outer* class's property: `NotFound`, not the outer `prop` (q5). A method arg shadowing a property loses to `this.x` while the bare name wins (q8, three distinct symbols). `super.x` in a non-extending inner class nested in an extending outer class is `NotFound` (q6); a plain lexical miss in the same position borrows the outer base (q7) — the documented nearest-extends-carrying assumption, behaving as written. - *`cls::`.* The pinned rule holds: an in-file package with no such member is `NotFound`, both from a module (q9) and from inside an extending class (q10) — the extends fallback does not leak into the package arm. Class tail-miss → `InheritedCandidate`; `cls::CONSTANT` and `cls::static_var` resolve from a module and from a sibling class (q29). A non-unit shadower (`int base;` in the way of `extends base`) is skipped (q27). `outer::inner` resolves to the nested class; a bare `inner::K` from outside is `ExternalCandidate { ["inner::K"] }`, which the member table (keyed by class name) answers — consistent, no gap. - *Out-of-body.* Prototyped and non-prototyped shapes both bind into the class scope (q14), including a definition written *before* the class (q28) and `task p::c::run` through a package-qualified path (q15). Method locals never reach the class outline in either shape (q16). - *Outline.* Nested classes nest their own members; method locals sit under the method, not the class (q25). - *Tolerant trees.* Six broken shapes (missing `endclass`, `extends;`, broken prototype arg list, `::`-leading definition, duplicate nested name, self-extends) analyze without panic at every byte offset, and every non-empty span still slices back to its own name (q17). Spaced `c :: f` and `extends base ;` cost a reference but never mislocate one (q18). - *Workspace.* Cross-file `extends p::item` resolves head → package, tail → class through the overlay (q19). - *scan.rs.* 26 call sites at `da1448e` → **3** now, in exactly the two documented consumers (`bind_data_type` at `bind.rs:1082,1089`; `StmtKind::Disable` at `bind.rs:913`). Zero new usage from class binding. Status section's wording is accurate. **Sabotage check.** Rewrote `this_member` to try the full lexical chain first. Exactly one test caught it — `classes.rs:179` `this_resolves_members_in_the_class_scope_only` (`this.prop` resolved to the shadowing `TfArg` instead of the property). The corpus test did not. Reverted; `resolve.rs` verified byte-identical to the pre-sabotage copy and the diffstat back to 185/20. **Findings.** - *Should-fix, LOW.* **A unit-name miss inside an extending class returns `InheritedCandidate`, not the `ExternalCandidate` rules 5 and 8 document.** `resolve.rs`'s `unit()` ends in `miss(scopes, from, external, true)`, and `miss` consults `nearest_extends` before honouring `always_external` — so any `p::x` head, or a nested class's own `extends` base, written inside a class that extends, lands in the inherited bucket. Repro: ```systemverilog class c extends base_c; function void f(); int x = other_pkg::THING; // head → InheritedCandidate endfunction // { base: "base_c", endclass // paths: ["other_pkg"] } module m; int y = other_pkg::THING; // head → ExternalCandidate endmodule // { paths: ["other_pkg"] } ``` The same happens to `class inner extends other_base` nested inside `class outer extends base_c` → `InheritedCandidate { base: "base_c", paths: ["other_base"] }`. The paths are still carried, so nothing is *wrong*, but `resolve_external` ignores the inherited bucket by design, so the workspace never gets to answer these. Measured cost: **170** clean-file references whose bare-name path the index *does* hold as a unit — real go-to-definition the LSP loses (0.25 % of clean references; it is also part of the 92.5 → 91.0 move, on top of the population change). Two honest fixes, dev's choice: thread `always_external` *through* to suppress the inheritance fallback for unit lookups (a base class cannot supply a package name), or state the deviation in rules 5/8 and let the overlay chase `InheritedCandidate.paths`. Filed, not fixed — it is a design call, not a typo. - *Observation, no action.* The `InheritedCandidate` bucket is 4 980 clean-file references; of those, **1 303** name a member the indexed base class genuinely has. That is the size of the documented future round, and it confirms the variant is carrying the right information for it. - *Observation, no action.* Class-free clean files show 21 fewer references and 15 fewer external candidates than at `da1448e` (56 084 → 56 063; 11 475 → 11 460) with 3 *more* answered. Consistent with the `this`/`super`/`null`/`new` suppression and the `Target::Package` → `Target::Unit` widening reaching a little non-class code; immaterial and in the right direction. The Assumptions section already warns the populations are not line-by-line comparable — they are, to within 0.04 %, outside classes. - *Recommendation, no action taken (out of this QA's write scope).* The pinned package-tail-miss rule still has **no permanent test** — the vlog-semantic QA log records it living in a since-deleted scratch suite, and neither `semantics.rs` nor `classes.rs` pins it today. It survived this round's `Target::PackageMember` → `Target::UnitMember` rewrite (I re-checked it by probe, twice, including from inside an extending class), but a rewrite of that arm is exactly what would silently break it. Worth three lines in `classes.rs`. - **No BLOCKING findings.** No panic, no unplaced name, no wrong span, no wrong resolution: `this.x` never hit a shadow, inheritance was never chased, and the pinned `NotFound` rule held under every attack. ## Review **2026-08-20 — lead. Verdict: accepted after one directed fix; commits with round 20. The LSP navigation gap inside classes is closed: UVM code now has hover, definition, references and outline, with 114k spans bound and zero unplaced.** Points reviewed and accepted: 1. **`InheritedCandidate` is the honest shape** — recording what an unknown base *might* supply (with the import paths widened in, rightly: extends and imports both compete to supply a member) instead of pretending inheritance resolution. QA confirmed the never-chased crux even for in-file bases, and its 1,303-candidate measurement is the precisely-sized backlog for the future chasing round. 2. **The unit-vs-member routing fix** (QA-found, lead-ruled: a base class supplies members, not package or class names) recovered exactly the 170 lost navigations QA measured, is pinned by a test distinguishing both routes from inside one extending class, and is reported with the 198/170/28 accounting rather than a flattering rate claim. The pinned package-tail-miss rule finally has its permanent test — three lines that would have caught the exact rewrite that nearly broke it this round. 3. **The scan.rs migration** (26 call sites → the 2 documented consumers, everything else on parser name-spans) was the stretch goal delivered as a side effect of doing the work properly. 4. **The corpus movement is honest**: in-file resolution *dropped* as predicted (UVM externals entered the population), unresolved fell (this/super/null/new noise removed), and QA's flat-control check (class-free files: 92.7% → 92.8%) proved the rate move is entirely population, not regression. 5. `this.x` nearest-class-only survived sabotage with exactly one test catching it — a reminder the corpus alone doesn't police scope subtleties; the unit suite does. With this, round 20 closes and the owner's item-3 requirement is delivered. The inheritance-chasing round (1,303 candidates), DataType spans (scan.rs's last consumer), and Disable name-spans remain filed where they belong.