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

+54
View File
@@ -165,6 +165,10 @@ the same two grammar rules and cost nothing:
workspace) all clean.
- [x] Idempotency swept by hand over all 712 passing corpus files, not just
the 13 new ones.
- [x] QA round-1: `skip_action_stmt` tracks `begin`/`end`, `fork`/`join*` and
`case`/`endcase` nesting, so an action block that is an `if` with a
`begin ... end` body (with or without `else`) is captured whole
(3 parser tests + 2 cases).
- [ ] **Not done, deliberately:** canonical layout for property/sequence
expressions; `expect property`; `cover sequence`; `default clocking` /
`default disable iff` (interface cluster's).
@@ -278,6 +282,56 @@ Files changed:
- `README.md` — "Supported syntax" bullet, roadmap items 7/7b/8
- `docs/features/assertions/README.md` — this file
### 2026-08-21 — dev (response to QA round 1)
The round-1 finding below — `skip_action_stmt`'s generic branch tracking
brackets but not `begin`/`end`, so an action block like `if (c) begin x = 1;
end else y = 2;` ended at the first `;` *inside* the nested block — is fixed.
`skip_action_stmt` is now one loop with a block-keyword depth counter beside
the bracket skipping. It counts the openers `BLOCK_OPENERS` (`begin`, `fork`,
`case`/`casex`/`casez`/`randcase`) against the closers `BLOCK_CLOSERS`
(`end`, `join`/`join_any`/`join_none`, `endcase`), and:
- a `;` ends the statement only at depth 0, so a `;` inside a nested block no
longer ends the scan;
- a statement that *ends* with a block ends there — no `;` follows one — and
the scan then reads the optional `end : label` and continues only if an
`else` follows, which is what makes the `if`/`else` shape whole;
- `disable fork` / `wait fork` are matched as a pair and skipped: they name
the enclosing block rather than opening one, and counting them would have
broken the very common UVM `fork ... join_none` + `disable fork` action
block;
- a closer at depth 0 (nothing open) is a clean `expected ';'` error where it
stands, which is both a better position than the old run-to-EOF and the
reason the counter can never underflow.
The termination argument the QA log asked about still holds and is now in the
doc comment: `at_eof` is checked on every turn and every arm consumes at
least one token, so unbalanced input is a clean parse error, never a loop and
never a read past the end of the file. Both directions are pinned by
`an_unbalanced_action_block_is_a_clean_error`.
Tests: three parser tests (`an_action_block_keeps_a_nested_begin_end_whole`,
`an_action_block_may_be_a_fork_or_a_case`,
`an_unbalanced_action_block_is_a_clean_error`) and two cases in
`assertions.cases` (the `if`/`begin`/`end`/`else` shape and a
`fork ... join_none` with `disable fork` inside), each with a following item
asserted to survive so a future over-greedy scan is caught.
The old special case that required the pass statement's *first* token to be
`begin` is gone — it is now just depth 1 on the first token — so the previous
begin-block behaviour is unchanged, `begin`-first or not.
Score unchanged before and after
(`{"passing":800,"total":820,"pct":97.6,...}`), passing set identical, all
800 passing files byte-identical against the pre-change binary, two-pass
idempotency sweep clean.
Files changed: `crates/vlog_parser/src/parser.rs` (`skip_action_stmt`, the
two new consts, 3 tests), `crates/vlog_formatter/tests/cases/assertions.cases`
(2 cases).
## QA log
### 2026-08-21 — round-1 adversarial QA