Error recovery inside headers and lists: error elements, a list-local bracket-seeded sync that cannot stall, headers keep their node
TODO section 32 (coverage_gaps M10).
A typo inside a port list, parameter list, tf-port list, connection
list or a for/if/while/case header no longer destroys the enclosing
module or function. The four list element types and ExprKind gain an
Error(RawText) element; element_or_recover records the diagnostic and
skips to a list-local sync set (',' ')' ';' or a line change) with the
bracket counter seeded from the list's own opener, and list_ends ends
any list whose iteration left the cursor unmoved - the structural
guarantee that closes the non-advancing loop which exhausted memory on
the first cut. Headers are infallible in tolerant mode: the node keeps
its name, the typed elements and its body, so the body binds in the
right scope and there is no orphaned closer; recovery declines on a
conditional-compilation directive so split.rs's verbatim rescue still
runs and strict parity holds (550 fixtures and all 814 strict-parsing
corpus files, Debug-equal). Pins per shape with exact counts; server
pins: document symbols and scoped completion survive a broken header,
one diagnostic, the three validity probes keep their verdicts.
Census over the corpus truncated at each midpoint: error nodes 622 ->
555, diagnostics 1 702 -> 1 826 (surviving modules now report their
missing endmodule). parse_tolerant timing within noise. 3 259 tests on
this branch (0.35.0 + 15 pins); corpus 814/820 byte-identical.
docs/features/header-recovery/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
f1d44a2a0c
commit
747ae02b0e
10 files changed
+561
-44
No files matched your search
@@ -61,7 +61,7 @@ request.
|
||||
| M7 | Semantic lints (`unused-signal`, `undriven-net`, `multiply-driven`) ship **off by default**. | linter-core / semantic-lints READMEs; blocked on topo §2.9-6 (workspace-wide "does any file mention this name"). | These are the lints RTL engineers want most; the index now has reference postings and `files_spelling`, so §2.9-6 is closer than when filed. |
|
||||
| M8 | ~~Lint rules do not descend into verbatim regions~~ — **closed at 0.33.0 for what parses**, by construction: the rules read the reference table, and a structured assertion contributes ordinary references to it. A `signals.rs` `opaque_span` remains only for a region that fell back. | assertions / clocking-wave / sva-bodies READMEs. | Same root as C1; resolved with it. |
|
||||
| ~~M9~~ | ~~Statement-level format fences (inside `always`, case items, port lists) and fences inside class bodies (topo §2.9-3).~~ — **closed at 0.34.0+ by TODO §31.** Class bodies and every statement *list* (`begin`…`end`, `fork`…`join*`, function/task bodies, `initial`/`always`/`final` bodies, a `case` item's block body, a statement fragment) are fenceable scopes; `--lines` still loses to a fence. Two of the three named places stay out, with reasons: port/parameter lists and `case` **label** lists print mid-line inside a `Group`, where `Doc::Verbatim` (column-0, break-forcing) cannot stand — that wants a new printer primitive, not a scan arm. Measured on OpenTitan, which has 9 fenced files: four now keep their fenced bytes, including a 110-line class-body region. | statement-fences README; format-fences / classes / shared-fence-filter READMEs amended. | Users protect hand-aligned tables inside procedural blocks; DV users protect them in classes. |
|
||||
| M10 | Error recovery does not reach headers and lists (port lists, parameter lists, for-headers) — a half-typed port list yields a garbage tree. | error-recovery README (QA-confirmed). | Editing experience: diagnostics cascade while typing a header. |
|
||||
| ~~M10~~ | ~~Error recovery does not reach headers and lists (port lists, parameter lists, for-headers) — a half-typed port list yields a garbage tree.~~ — **closed by TODO §32.** A list element that does not parse is now a `ListElem::Error` element of its own list and a statement header's broken condition an `ExprKind::Error`, so the module, function or instantiation keeps its name, the elements that were typed and its body: the QA shape that cost 3 items and 2 diagnostics costs 1 and 1, and the `wire w;` under a half-typed `sub u (.a(` is a sibling item again. Measured over the corpus truncated at each file's midpoint: **622 → 555 error nodes** (−11 %), while diagnostics rise 1 702 → 1 826 because the constructs that now survive report their own missing closers (`expected \`endmodule\`` +91) instead of vanishing into one node. | header-recovery README; error-recovery README amended. | Editing experience: diagnostics no longer cascade while typing a header, and the outline keeps the module. |
|
||||
| M11 | Anonymous aggregate members (`enum {A,B} x;`) not symbols (topo §2.9-13); cast type `state_t'(0)` records no reference. | overlay-promotion README; probe: enum *typedef'd* members do work. | Partial: named enums navigate, anonymous ones do not. |
|
||||
| M12 | No `lint` key in `lucisv.toml` (topo §2.9-4); no `--rules-doc`. | four READMEs. | Config surface, not language — but it gates per-project rule selection. |
|
||||
| ~~M13~~ | ~~Modport method prototypes (`import task drive(int x);`), `const` task/function arguments, unnamed DPI formals.~~ — **closed at 0.33.0 by TODO §30.** Modport method prototypes parse, format, bind and span; unnamed DPI formals parse behind the DPI flag only (§35.5.5), print as their type alone and declare nothing. The `const` half was **misfiled**: `const ref` (§13.5.2's only `const` argument form) has parsed and formatted since the corpus shape landed — the probe found only one real gap, a comment written *between* `const` and `ref`, now its own slot. | interface-dpi-arms README; interfaces / dpi-export READMEs. | Real interface-class idioms; each was a small grammar arm. |
|
||||
@@ -149,9 +149,11 @@ signal named only inside a property edits it, references list it, and the
|
||||
"at least identifier occurrences" fallback the C1 row asked for was
|
||||
overtaken rather than built (what the grammar cannot read still rewinds to
|
||||
the byte-exact capture, and rename *names* those regions instead of going
|
||||
quiet). What the tables above still leave open, by weight: M10 error recovery
|
||||
inside headers and lists; the second half of
|
||||
M12 (`--rules-doc`, §2.9-5); L3, L6, L9 and L10. M13's small
|
||||
quiet). What the tables above still leave open, by weight: the second half of
|
||||
M12 (`--rules-doc`, §2.9-5); L3, L6, L9 and L10. M10's error recovery inside
|
||||
headers and lists is closed (TODO §32), with the narrowing recorded in its
|
||||
row: a truncated file reports *more* diagnostics than before, because the
|
||||
constructs that now survive say what closer they are missing. M13's small
|
||||
interface/DPI grammar arms are closed (TODO §30) — with one narrowing
|
||||
recorded there: a single `import` may carry one prototype, not a
|
||||
comma-separated list of them. M9's format fences are closed too (TODO §31,
|
||||
|
||||
Reference in new issue
Block a user