diff --git a/docs/JOURNAL.md b/docs/JOURNAL.md index b2ed7fb..ffab266 100644 --- a/docs/JOURNAL.md +++ b/docs/JOURNAL.md @@ -12200,3 +12200,75 @@ Observation, not debt: `crates/ailang-codegen/src/drop.rs:379` has a `matches!(name.as_str(), "Str")` single-element check (not the 4-set) — distinct invariant (heap-string-only semantics), out of scope for this consolidation. + +## 2026-05-10 — Iteration 22-tidy.5: strict duplicate-clause detection in fn/const/data parsers + +Closing the second milestone-22 carried-debt item flagged in +`2026-05-09 — Iteration 22-tidy`: the strict duplicate-clause +detection that 22b.4a introduced for `parse_class` / +`parse_instance` / their method sub-parsers (10 sites) was missing +from the sibling parsers `parse_fn`, `parse_const`, `parse_data` — +those silently last-wins on duplicate clauses. This iteration +lifts the strict pattern to those three siblings. + +Sites promoted to strict (8 total): + +- `parse_fn`: `doc`, `type`, `params`, `body` +- `parse_const`: `doc`, `type`, `body` +- `parse_data`: `doc` (only — `ctor` is multi-instance, + `drop-iterative` was already strict from Iter 18e) + +Each new strict check uses the established 22b.4a pattern +(`if X.is_some() { return ParseError::Production { … } }`) and +the established message form +(`` " `` has duplicate `( ...)` clause" ``). +Eight new RED-first unit tests in `parse.rs::mod tests` pin each +diagnostic. + +Mid-iter fixture correction (Task 2): the planned `parse_const` +body fixtures used `(body (lit (int 42)))`, but bare integer +literals in the surface are tokenised directly (`Tok::Int`), not +as a `(lit (int N))` term. Implementer substituted bare integer +literals (`(body 42)`, etc.) — preserves the load-bearing +duplicate-clause assertion. + +Mid-iter fixup (Task 2 review): Task 1 originally added +`/// Iter 22-tidy.5: …` rationale doc-comments to the four +`parse_fn` tests, but Task 2 omitted them per CLAUDE.md comment +policy ("Don't reference the current task, fix, or callers"). +For consistency, the iter-tag doc-comments were stripped from +Task 1's tests in commit `9097b88`. + +Tasks (commit subjects): + +- 22-tidy.5.1: parse_fn rejects duplicate doc/type/params/body clauses +- 22-tidy.5.2: parse_const rejects duplicate doc/type/body clauses +- 22-tidy.5.2: drop transient iter-tags from parse_fn duplicate-clause tests +- 22-tidy.5.3: parse_data rejects duplicate doc clause + +Acceptance: 8 new tests RED-first then GREEN; full workspace test +sweep green (`cargo test --workspace` 0 FAILED across 23 test +binaries); bench gates 0/0/0; no behaviour change for valid +fixtures (the round-trip suite stays green). The strict-vs-loose +asymmetry between class/instance and fn/const/data parsers is +retired. + +Observation (out-of-scope, queued): the duplicate-clause check +pattern now appears at 18 sites across the parser (10 from 22b.4a ++ 8 from this iter). A `check_clause_unique!` macro or +`fn duplicate_clause_err(production, name, clause, pos)` helper +would consolidate them. Quality reviewer flagged as Nit during +Task 1 review; left for a future iter. Three similar lines beats +a premature abstraction; eighteen similar blocks may be the +tipping point. Re-evaluate next time the strict pattern needs +extending. + +Carried-debt status (after this iter): + +- ✅ Primitive-name-set consolidation (closed 22-tidy.4). +- ✅ Strict duplicate-clause detection in fn/const/data (this iter). +- ⏳ Form-B (prose) printer arms for ClassDef / InstanceDef — still + queued. +- ✅ Lib.rs gap-related sites at lib.rs:1266 / 1853-1856 / 1978 / + 2314-2316 — audit confirmed defensive (no action needed; see + `2026-05-10 — Audit: mono-pass env-seeding gaps`).