Format fences at statement level and inside class bodies

TODO section 31 (coverage_gaps M9, docs/topo.md 2.9-3).
fence::collect enters class bodies, functions, tasks and always/
initial/final blocks, and statement lists - begin/end, fork/join and
every compound body - through scan_stmt_scope/scan_nested_stmt on the
one scan_units both scope kinds share; stmt_docs/stmt_seq obey the two
swallowed-unit rules item_docs/item_seq had; fence regions merge into
range.rs's plan, which was load-bearing (a fenced statement has no
verbatim run behind it; proved by disabling it). A region opens only at
a line start (opens_line) - the rule the format-fences README has
stated since round 1 - so a fence after code on the same line is an
ordinary comment everywhere, which narrows one accidental item-level
shape (module m; // lucisv: off) and is ruled a drift fix. Deferred
with reasons: port lists, case-item label lists, same-line fences, a
property's locals. verify.rs, lucisv/src/lint.rs and
lucisv_server/src/lint.rs untouched.
Proof: 3 244 tests / 48 binaries, fences.cases 25 -> 38 with the
statement-level entry inverted, corpus 814/820 and 860 files byte-
identical to 0.34.0, opentitan: 4 of its 9 fenced files now keep their
fenced bytes and are fixed points, --check counts identical; 3 348
fence-injection trials with no new refusals.

docs/features/statement-fences/README.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-09-03 03:40:12 -07:00
1 parent 965c4ee25a
commit a0ae5e5fa8
14 files changed
+1395 -90

No files matched your search

+13 -4
View File
@@ -184,7 +184,14 @@ indexed, hovered or navigable.** That is a real LSP gap, not an oversight, and
it is the natural next round for that crate. **Delivered 2026-08-19 by
`class-semantics`** — see `docs/features/class-semantics/README.md`.
**Requested of `vlog_formatter::fence` (out of this feature's scope):**
**Requested of `vlog_formatter::fence` (out of this feature's scope) —
DELIVERED 2026-09-03 by TODO §31 / `docs/features/statement-fences`.**
`scan_nested` now carries the arm this section asked for verbatim
(`ItemKind::Class(c) => scan_scope(src, &c.items, &c.dangling, out)`), plus
the statement scopes a class's methods hold, so the probe below is now
formatted exactly as its module twin is and the asymmetry the lead note
describes is closed. The original request, kept for the record:
`scan_nested` enumerates the item scopes a fence can live in — module,
package, generate region, generate `if`/`for`/`case` — and ends in a `_ => {}`
catch-all, so a class body is not scanned. Probed and confirmed:
@@ -332,9 +339,11 @@ non-zero verification-error count.
- [ ] **Not done, deliberately:** canonical layout for constraint and
covergroup bodies. Two grammars, no layout convention worth inventing,
and the verbatim path is corruption-proof by construction.
- [ ] **Not done, out of scope:** fences inside class bodies (`fence.rs`, one
arm) and lint-rule coverage of class members (`visit.rs`, one arm).
Both filed under Handshakes.
- [x] **Fences inside class bodies** (`fence.rs`, one arm) — filed under
Handshakes, delivered 2026-09-03 by TODO §31
(`docs/features/statement-fences/README.md`).
- [ ] **Not done, out of scope:** lint-rule coverage of class members
(`visit.rs`, one arm). Filed under Handshakes.
- [ ] **Not done:** `` `uvm_field_int (x, y)`` — a macro invocation with a
space before its `(`. Ten of the 70 still-blocked ex-`extends` files die
on this, and it is the documented `macro-items` gap (their Assumptions,