TODO §47 (docs/features/type-name-spans). Closes topo §2.9-2.
`DataType` carries `name_start` (a `u32` in its existing padding, so
`Expr` stays at its 96-byte pin) and derives `name_span()` and
`segments()` — the `::`/`.` split from the span's own text, with a
leading escaped identifier read to its terminator first. Five parser
construction sites set it; an implicit type gets the empty range at the
position its name would have had. `StmtKind::Disable { name, name_span }`.
The binder walks `ty.segments()` and verifies every segment's range
against the source before recording it (`exact_or_empty`); a segment that
does not read back is recorded with the empty range, never dropped, so
the census's `unplaced` counter is the alarm a join regression would
move (review rework of QA's MEDIUM). `scan.rs` deleted; `bind_data_type`
lost its `window` and ten call sites their window arithmetic.
Census unchanged in every field (860 files, 27 486 symbols, 103 870
references, 1 197 unresolved, 0 unplaced); 0 of 860 corpus files differ;
200/200 opentitan definition/hover/typeDefinition answers identical.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
TODO section 21, round 2 of coverage_gaps C1, closing it. A covergroup
was a flat token scan into verbatim text; now ItemKind::Covergroup with
CoverItemKind::{Coverpoint, Cross, Option, Directive, Empty}, BinDecl
(wildcard, kind, array, spec: Values / Transitions / Default /
DefaultSequence / Select, with, iff) and SelectExpr for binsof ...
intersect ... && !binsof - behind the same Rewind fallback as
constraints (v0.27.0's scan re-run character for character on any
failure), no keywords reserved. The bin '(' ambiguity is settled by
position, the LRM's own rule, which replaced a lookahead scan and took
the fallback count to zero. Two guards in shared expression machinery -
an index cannot begin with *, -> or =; a bin's own with (...) filter is
not an array-method iterator argument - both attacked across the corpus
and the opentitan tree. Canonical layout, verify.rs untouched, thirteen
attack pairs. Every sampled expression binds to the class's properties;
cg_inst.cp resolves cross-file; FACTS_FORMAT 11 -> 12. The gap fuzzer
was built in from day one and its classification is asserted, not
claimed.
Opentitan: 544/544 structured, 87/87 DV covergroup files idempotent
with comment streams byte-identical, sweep and per-file diagnostics
identical. Corpus +1139 references, 1135 answered.
docs/features/covergroup-bodies/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
TODO section 20 round 1, coverage_gaps C1 for constraints. A constraint
declaration was opaque text with no name span; renaming a rand field
left constraint c { user_id < 5; } as non-compiling code. Now
ItemKind::Constraint with a structured ConstraintSet (Expr{soft},
Implication, If, Foreach, SolveBefore, Unique, DisableSoft, Directive,
Empty), ExprKind::Dist, and randomize() with bodies as
ConstraintBody::{Items, Verbatim}. The parser attempts the structured
body behind a Rewind snapshot - cursor, both pending-comment buckets,
depth, links, open_conds, diagnostics - and on any error re-runs
v0.26.0's verbatim capture character for character, so an unknown body
IS the old behavior. No keywords reserved: soft/dist/solve/before are
matched by text, so logic before; keeps working and token.rs, pairs.rs
and the editor grammar are untouched. Canonical layout, verify.rs
untouched, attack pairs re-derived and extended. Every operand binds to
the class's properties (foreach vars nest; a with block resolves against
the randomized object's class first), so hover, definition, references
and rename reach inside. FACTS_FORMAT 10 -> 11. Lint rules read
constraint operands.
QA's finding - comments after the round's own words were dropped and
the safety net refused the file - answered with an exhaustive gap fuzzer
(358 gaps, format and idempotency demanded) and fourteen named comment
fields; the forty gaps that remain are shared machinery that fails
identically outside a constraint, filed as topo 2.9-22. Opentitan: 1993
of 2009 bodies structured, sweep unchanged, 48 DV files idempotent with
comment streams byte-identical, per-file diagnostics identical.
docs/features/constraint-bodies/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
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]>
DV round 2 (TODO section 15 round 2). A chain tail carries spellings -
Target::MemberOf { head, mids } - so in-file it hops declared type to
declared type, and a chain that leaves the file becomes one composed path
Unit::mid::tail that follow_one walks with member_type hops: no deferred
resolution, no ordering assumption, and chain tails post to the index
through the existing contract so hover, references and rename agree.
Def::type_name rides every indexed declaration (FACTS_FORMAT 6 -> 7,
with ReferenceFact base so this.x uses post cross-file); an instance
symbol's type is its module, and modules export ports and parameters -
nets/vars stayed in-file on measurement (+24 percent store, and .port(w)
connections would have resolved to internal nets). Typedef aliases are
chased with a visited guard; a type the workspace declares twice with
different kinds is refused one hop out, the round-1 lesson applied.
The rename truth flipped with it: u_sub.sig IS sub's wire sig and is
renamed alongside it; an unresolvable tail is left alone but no longer
warned about, filed as topo 2.9-20.
Corpus: references 97454 -> 98919, unresolved unchanged at 1256,
store +15.4 percent. QA: zero wrong answers across the attack suite and
15 live opentitan probes.
Co-Authored-By: Claude Fable 5 <[email protected]>
DV round 1 (TODO section 15). The tail of head.member gets a reference
when the head is a plain identifier whose declared type (Symbol::type_name,
new) is a class or module: the member is found in that scope, else up the
in-file extends chain, else the workspace's member table chases
WorkspaceIndex::base_of (a subclass-to-base map rebuilt from the existing
inheritance census, no new facts field) - cycle-guarded on both sides and
placed in follow_one so hover, cross-file references and rename cannot
disagree. this.x/super.x misses ride the same loop, delivering topo
2.9-9. An out-of-class method body (task c2::update) sees its class's
members through a stand-in Class scope. FACTS_FORMAT 5 -> 6: the layout is
unchanged but the reference census grew.
Honesty by construction, after QA's one REWORK: a head whose type is
declared in-file as anything without a member scope (typedef, alias,
enum, param) records nothing - a two-state Option had stood in for the
three-state TypeHere question, and a typedef named bus_t could have been
answered by an unrelated class bus_t elsewhere. The fix removed exactly
438 wrong postings from the corpus with unresolved unchanged at 1256.
Hover 7-143 us; opentitan tl_seq_item member 0.12 ms cold, 0.01 ms warm;
store +2.85 percent.
docs/features/class-member-access/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
prepareRename answered F2 by reading every in-scope file (1.6-3.0 s on
opentitan, blocking the loop); it now answers from the open buffer and
the index in 139 ns, with a refusal-by-refusal parity table (7
reproduced, 4 deferred to rename, none lost). rename computes over
rename_sources — declarers, reference postings, open buffers, and,
after QA's HIGH finding gated the round, rung 6: files_spelling over
the index's reference facts (resolved or not, FACTS_FORMAT untouched),
restoring the dangling-new-name capture refusal the first five rungs
lost; the old name needs no rung and the argument is written and
pinned, QA's shadowing hunt included. 3.47 s -> 105 ms at a 7-file
fan-out, rung cost 852 us worst-case, byte-parity swept at four real
cursors and 564 offsets, ambiguity escaping to the whole scope.
willRenameFiles rides IncludeGraph::includers(): 249 ms -> 14 ms over
331 includers of 3 976 files. Accepted residue, documented: files
whose only mention of the name is inside opaque macro tokens lose one
warning flavour; the FileFacts macro census is filed as the real fix.
Dev Opus + QA Sonnet (REWORK-gate, fix, SHIP on re-verify) in a
dedicated worktree. Lead-reviewed and merged.
Co-Authored-By: Claude Fable 5 <[email protected]>
textDocument/references now reads declaration-to-occurrence postings
merged in WorkspaceIndex from compact per-file reference facts, with
open buffers overlaying live semantics — 0.062 ms/request over 820
files vs 21.7 ms for the old Workspace::sources() walk (~350x). The
walk stays as rename's engine and the equivalence oracle in tests.
FACTS_FORMAT 1->2 discards v1 caches whole. Cursor lookups
(symbol_at/reference_at/token_at) and macro-define lookup move to
binary-searched sorted tables; include definition inspects only the
cursor's line. Ambiguity refusals preserved throughout.
External dev: codex. Lead-reviewed, gates re-run, probe reproduced.
Co-Authored-By: Claude Fable 5 <[email protected]>
Delivers the Handshake docs/features/type-definition/README.md filed:
an unqualified lexical miss written where a TYPE goes — bus_if bus;,
my_cls h;, a cross-file typedef — now carries its bare name to the
workspace overlay (last, so imports still win), in both spellings:
ExternalCandidate, and InheritedCandidate inside extending classes,
whose base and count (7,841, bit-identical) are untouched. The
mechanism is a new Target::Type emitted only by bind_data_type's
unqualified arm; value-position identifiers, disable labels and
redeclarations keep their pre-round Target::Lexical behavior — NotFound
stays NotFound, and rename keeps refusing them.
That value/type split is the round's story: QA rejected the first cut
with a kept repro proving a value-position typo could rename an
unrelated same-named module cross-file (write-by-coincidence,
pre-round refused), and disproved the work log's exposure claim
against the pre-round source. The fix is a four-line behavior delta;
QA re-killed the regression from three angles and reproduced every
corpus figure to the digit. Result over the 860-file corpus: NotFound
1,418 -> 1,256, 418 clean-file references gained a jump target, none
lost one, 141 coincidence-answers deliberately given back.
The server's stopgap is deleted whole: type_def.rs::indexed_type,
qualifier guard included — all 45 type-definition tests green
unchanged, and cross-file interface rename from a type window is newly
possible and pinned. Corpus formatter results byte-identical (813/820
both trees). New docs/features/overlay-promotion/README.md; the
vlog-semantic and workspace-index tables re-measured (the committed
baselines had gone stale several rounds ago; both READMEs now carry
the three-state table).
Co-Authored-By: Claude Fable 5 <[email protected]>
New crate vlog_refactor: rename any symbol vlog_semantic resolves, in-file
and cross-file, with whole-edit-or-nothing verification (token identity +
before/after resolution print over every file spelling either name).
End labels rename too via a new vlog_semantic Target::Declaration bound at
declaration time. Server ships prepareRename/rename; refusals are LSP
request errors, define-body/macro-argument/hierarchical-tail occurrences
warn instead of guessing. QA round 1 found two silent HIGHs (third-file
collision, macro-argument silence) — both closed with regression tests.
Co-Authored-By: Claude Fable 5 <[email protected]>
class-semantics: classes are first-class in vlog_semantic -- class
scopes and symbols, member/method/prototype binding, this.x
(nearest-class-only), super.x, cls::x with lexical unit heads,
out-of-body cls::method bound into the class's scope with the extern
prototype as the definition (rule 10), and the honest
InheritedCandidate{base, paths} shape: a member miss in an extending
class records what the unknown base might supply (import paths
included) and is never chased, not even in-file -- the future
inheritance round's worklist, measured at 1303 candidates. Unit-name
misses stay ExternalCandidate (QA-found, lead-ruled: bases supply
members, not package names; +170 recovered navigations, pinned).
Workspace index gains classes as units (246) and their members
(11399). scan.rs migrated to parser name-spans: 26 call sites down
to the 2 documented consumers. 114044 spans, 0 unplaced, 0 panics;
UVM code now has hover/definition/references/outline.
lexer-cleanup: the three filed gaps -- @(* ) lexes via a
starts_attribute backoff (an attribute cannot begin with `)`; real
attributes pinned, no misfire on legal expressions), a leading BOM
is accepted as a named losslessness exception (mid-file BOM errors
clearly; 20k-case position fuzz clean), and non-ASCII lex errors now
decode the full character AND surface through vfmt check's error
slot (exit 2, matching format, text-rule findings still reported --
the silent-pass hole closed). The macro space-before-paren item is
parked with a QA-hardened analysis: the reading depends on a
definition vfmt cannot see, any fixed answer is provably wrong for
one population, and today's behavior fails safe.
827 workspace tests. Dev: 2 Fable agents; QA: 2 Opus agents; reviews
in docs/features/{class-semantics,lexer-cleanup}/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
workspace-index (vlog_semantic): cross-file resolution -- the
owner's `import pkg::*;`-anywhere requirement delivered.
WorkspaceIndex maps modules/packages/file-scope typedefs, package
exports, module ports/params and per-file define tables; built
tolerantly (broken files still contribute), deterministic by
construction (FileIds assigned after path sort). resolve_external
answers ExternalCandidates in a two-layer overlay keyed by
ReferenceId -- Semantics stays a pure single-file fact; local
declarations outrank imports. Corpus: 87% of external candidates
answered (external rate 19.6% -> 2.6% on clean files), ambiguity
kept honest (OpenTitan prim_generic/prim_xilinx), 0.7s build,
workspace_symbols substring search.
name-spans (vlog_parser): the approved vlog-semantic handshake --
the parser records every declared name's span at parse time (28
fields across 21 node kinds; Name/ImportPath bundles where parallel
Vecs could desync; ImportPath splits p::x for the index). Content-
pinned by the exhaustive walker on every source, mutation-tested
three ways, zero behavior change (corpus md5 exact, QA byte-compared
formatter output against a HEAD worktree). scan.rs is now one
consumer away from deletion (DataType span, handshake item 2).
TODO §6 foundations complete: spans, error recovery, define table,
single-file semantics, workspace index. Next: vfmt_server.
Dev: 2 Opus agents; QA: 2 Sonnet agents; reviews in
docs/features/{workspace-index,name-spans}/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
vlog_semantic (new crate): single-file symbol tables and reference
resolution -- the layer that powers go-to-definition, references,
hover and document outline, and later the semantic lint rules.
Two-pass bind-then-resolve (Verilog forward references), 15 symbol
kinds, scope tree, and a three-state Resolution (Resolved /
ExternalCandidate carrying import paths for the future workspace
index / NotFound). scan.rs recovers name spans the AST lacks (95k
corpus spans verified; handshake filed and approved to move
name_span into the parser, which deletes the module). Corpus
baseline: 79.5% in-file resolution, 0.9% unresolved on clean files,
zero panics including tolerant-parse trees.
parallel-files (vfmt): rayon-parallel per-file formatting -- first
dependency, exact-pinned with written justification. 8 MiB worker
stacks discharge the recursion-limit handshake (sabotage-verified);
single-install panic hook discharges the cli-polish handshake;
deterministic input-order output (one stdout/stderr hash across 14
corpus runs at 4 thread counts); --threads flag; hand-rolled
.gitignore subset with 16/16 differential agreement against git
check-ignore. 3.6x wall-clock on the 860-file corpus.
Dev: 2 Opus agents; QA: 2 Sonnet agents; reviews in
docs/features/{vlog-semantic,parallel-files}/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>