Fix round-1 QA findings: Inline width in fits(), action-block nesting, comment gaps

printer::fits() now measures from a multi-line Doc::Inline's last line and
keeps measuring the rest of the group (a with {...} block no longer hides
an overflow). skip_action_stmt tracks begin/end, fork/join, case/endcase
nesting so a concurrent assertion's action block is captured whole.
Comments between bind/target/module and around randomize(...) with are
attached and reprinted instead of being refused by the safety net.
All 800 passing corpus files format byte-identically before and after.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-08-21 02:11:59 -07:00
1 parent e35da292bd
commit a4f8476894
14 files changed
+656 -57

No files matched your search

+51
View File
@@ -105,6 +105,11 @@ instantiation too (`bind.cases`, "implicit named *parameter* overrides").
### Promised / requested
- **`BindDirective::target_comments` / `::module_comments`** (QA round-1 fix):
the comments written between `bind` and the target, and between the target
(or the `: instance, list`) and the module name. Both are plain
`Vec<Comment>` fields, so no consumer had to change; only `Fmt::bind`
reads them.
- **New AST variant `ItemKind::Bind(BindDirective)`** in
`crates/vlog_parser/src/ast.rs`. Two exhaustive matches in other crates
needed an arm; both got the minimal one:
@@ -149,6 +154,11 @@ instantiation too (`bind.cases`, "implicit named *parameter* overrides").
- [x] `cargo fmt --all`, `cargo clippy --all-targets`, `cargo test` all clean.
- [x] Score after: 699/820 (85.2%), passing set a strict superset.
- [x] `TODO.md` and `README.md` updated.
- [x] QA round-1: comments between `bind` and the target, and before the
module name, are preserved (2 cases + 1 parser test).
- [ ] A comment written *inside* the `: instance, list` is still a clean
exit-2 refusal — `instances: Vec<Name>` has no `Meta` and no corpus
file writes one. See the 2026-08-21 work log entry.
## Work log
@@ -196,6 +206,47 @@ instantiation too (`bind.cases`, "implicit named *parameter* overrides").
from `counter_properties.sv:96`), so nothing in this category is left over;
those files belong to the `assertions` owner.
### 2026-08-21 — dev (response to QA round 1)
The round-1 finding below (a comment between `bind` and its target is dropped
internally and the file becomes unformattable) is fixed, together with its
sibling position (between the target — or the `: instance, list` — and the
module name of the instantiation).
Both positions sit between two tokens that no node owns: the target is a bare
`String`, so a comment written there had nowhere to attach and drifted onto
the instance below, which moves it across tokens and `verify_equivalence`
rightly refused the output. `BindDirective` now carries `target_comments` and
`module_comments`, harvested in `parse_bind` with the same `take_dangling`
the rest of the parser uses, and `Fmt::bind` prints each back where it was
written (`Fmt::inline_comments_spaced`, so a *line* comment ends its line and
the target starts the next one). Both round-trip and are idempotent; two
cases in `bind.cases` pin them, plus a parser test
(`the_comments_around_a_binds_head_are_kept`).
The QA note's "same class of gap ... after the module name / before the
instance name" turned out **not** to reproduce: `checker_mod /*c3*/ c_inst
/*c4*/ (.clk(clk));` already round-trips, because those two positions are the
instance's `meta.leading` and `conn_comments`, which `parse_instantiation`
has always harvested.
**Still refused, deliberately:** a comment written *inside* the `: instance,
list` (`bind dut : /*x*/ u_a chk u (.*);`). `instances: Vec<Name>` has no
`Meta`, and giving one to a list nothing else needs — no corpus file writes a
comment there — is the abstraction-for-a-second-user-that-does-not-exist the
project rules forbid. It stays a clean exit-2 refusal with the input
untouched, not corruption.
Score unchanged before and after
(`{"passing":800,"total":820,"pct":97.6,...}`), passing set identical, and
all 800 passing corpus files format to byte-identical output against the
pre-change binary; the two-pass idempotency sweep over them is clean.
Files changed: `crates/vlog_parser/src/ast.rs` (two fields on
`BindDirective`), `crates/vlog_parser/src/parser.rs` (`parse_bind` + 1 test),
`crates/vlog_formatter/src/format.rs` (`Fmt::bind`),
`crates/vlog_formatter/tests/cases/bind.cases` (2 cases).
## QA log
### 2026-08-21 — round-1 adversarial QA