Struct members: s.field, reg2hw.ctrl.q and the anonymous aggregates resolve
coverage_gaps H1 + topo 2.9-13 delivered. The in-file gap was one resolver gate: member_scope now returns any symbol's child scope when it is a Struct scope, so a typedef, an anonymous struct declarator and an inline nested field are one rule; fields declare with their own type so s.hdr.addr hops through a member. Cross-file, struct members export under the typedef's name, package-nested struct typedefs under their bare name (the nested-class convention, ambiguity refused), and inline nested fields - the opentitan register-package shape - under a synthesized owner.field key carried as the field's type: joined with '.', not '::', because member_type's last_segment would collapse the latter to the bare field name and q/d/qe live in every register package. Anonymous enum variants land in the enclosing scope like typedef ones. FACTS_FORMAT 8 -> 9; typeDefinition descends into typedef struct bodies. Unresolved fell 1203 -> 1162; the corpus store shrank 1.1 percent (resolved locals encode smaller than the candidates they replaced), opentitan's register packages grow it 4.3 percent. QA: 28 opentitan probes, three planted sibling pairs (rxfull/fmtfull, avsetup_rst/ avout_rst, tpm_csb/csb) all correct, zero wrong answers, hover under 0.5 ms. docs/features/struct-members/README.md; TODO.md section 17. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
95f930cf20
commit
2a2334ef5a
14 files changed
+1800
-85
No files matched your search
@@ -26,6 +26,11 @@ packed dimensions, a `type` parameter outside the `#( ... )` list — plus a
|
||||
- Enum member names introduced by an *anonymous* enum are not entered into the
|
||||
semantic model's scopes (only `typedef enum` members are). Nothing in the
|
||||
formatter needs them; see Handshakes.
|
||||
**Struck 2026-09-01 by struct-members** (`docs/features/struct-members/
|
||||
README.md`): they are now, in the scope holding the enum, exactly as a
|
||||
`typedef enum`'s are — and so are an anonymous struct's members and an
|
||||
inline nested member's. The assumption was only ever about what the
|
||||
*formatter* needed; the LSP gap it left is closed.
|
||||
- An anonymous `struct`/`union` body always breaks one member per line, like
|
||||
the `typedef struct` path it shares. An anonymous `enum` body is a group: one
|
||||
line if it fits, else one member per line — again the `typedef enum` rule.
|
||||
@@ -68,12 +73,18 @@ packed dimensions, a `type` parameter outside the `#( ... )` list — plus a
|
||||
|
||||
**Requests for other modules (not done here)**
|
||||
|
||||
- `vlog_semantic::bind` declares `typedef enum` members and `typedef struct`
|
||||
members as symbols (`bind.rs:395`, `bind.rs:406`). The equivalent members of
|
||||
an *anonymous* aggregate — `enum {A, B} x;`, the nested `struct packed {...}
|
||||
q;` of a register-package typedef — are not declared, so go-to-definition
|
||||
and hover do not find them. Purely an LSP completeness gap; the formatter
|
||||
and the corpus metric do not depend on it.
|
||||
- ~~`vlog_semantic::bind` declares `typedef enum` members and `typedef struct`
|
||||
members as symbols. The equivalent members of an *anonymous* aggregate —
|
||||
`enum {A, B} x;`, the nested `struct packed {...} q;` of a register-package
|
||||
typedef — are not declared, so go-to-definition and hover do not find
|
||||
them.~~ **Delivered 2026-09-01** by struct-members
|
||||
(`docs/features/struct-members/README.md`), which reads exactly the two
|
||||
hooks this section asked for: `DataType::inline()` and
|
||||
`TypeExtra::{Enum, Struct}`. An anonymous enum declares its variants in the
|
||||
enclosing scope; an anonymous `struct {…} s;` and an inline nested member
|
||||
each open a `Struct` scope of their own, so `s.a` and `reg2hw.ctrl.q`
|
||||
resolve, hover, navigate and rename. No parser change was needed — the AST
|
||||
this feature shipped was already the whole handshake.
|
||||
- `vlog_linter`'s `enum-name-style` / `struct-union-name-style` only look at
|
||||
`ItemKind::Typedef`, so an anonymous aggregate is out of their reach by
|
||||
construction. That is correct today (an anonymous type has no name to
|
||||
|
||||
Reference in new issue
Block a user