Commit 4dea918
fix(parser): remove duplicate [T] array-sugar production (#214)
`type_expr_primary` declared the array-shorthand production
`LBRACKET type_expr RBRACKET -> TyApp("Array", ...)` twice (lines
443/469) — added independently by issues-drafts/02 and #40 with
byte-identical semantic actions. The second copy was a verbatim
duplicate of the first.
Effects of the duplication, both confirmed via `menhir --explain`:
- Menhir reported "1 production is never reduced" (the second copy
is dead — the first always wins in the LALR automaton).
- It generated a real reduce/reduce conflict family: state 80
(reached after `[ type_expr ]`) could not choose which identical
production to reduce, and that ambiguity propagated through
inherited lookaheads.
Removing the dead copy and folding its substantive rationale (the
`Array`-not-`List` desugar reason + typecheck.ml canonicalisation
note + #40 ref) into the surviving comment so no documented knowledge
is lost.
Measured impact (full `dune test --force` gate green at 257/257 before
and after — zero parse-behaviour change, this is a pure dedup):
- "production never reduced" warning: eliminated.
- reduce/reduce conflicts: 36 -> 10 (R/R conflict states 5 -> 4).
- shift/reduce conflicts: unchanged at 75 (the duplicate was a
reduce/reduce source only).
The residual 75 S/R + 10 R/R conflicts are inherent LALR(1)
ambiguities that Menhir resolves deterministically and correctly (the
257-test suite, incl. STAGE-A AOT + multi-module + STAGE-B effect-row
coverage, proves the chosen resolution is the intended language).
This Menhir (20260209) has no expected-conflict declaration mechanism,
so eliminating the rest requires deliberate per-conflict grammar
refactoring with estate-wide parse blast radius — tracked separately,
not bundled here.
Refs #40
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 22d7dbc commit 4dea918
1 file changed
Lines changed: 8 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
441 | | - | |
442 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
443 | 448 | | |
444 | 449 | | |
445 | 450 | | |
| |||
458 | 463 | | |
459 | 464 | | |
460 | 465 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | 466 | | |
472 | 467 | | |
473 | 468 | | |
| |||
0 commit comments