Skip to content

fix(echo): patch build exhaustiveness gaps from PR #45 + TG-4 echo corpus#46

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/echo-build-exhaustiveness
Jun 14, 2026
Merged

fix(echo): patch build exhaustiveness gaps from PR #45 + TG-4 echo corpus#46
hyperpolymath merged 1 commit into
mainfrom
fix/echo-build-exhaustiveness

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

PR #45 (merged) added echo/product types to the OCaml pipeline but was authored without a working OCaml/menhir toolchain, so two exhaustiveness gaps slipped through that only surface at compile time:

  • compiler/lib/typecheck.mlstrand_type_of_ty: TProd/TEcho arms missing → Warning 8 promoted to error. Fixed with StrandDefault (same as TWord/TTangle).
  • compiler/bin/main.ml — debug token printer: all 8 echo keyword tokens (ECHOCLOSE, LOWER, RESIDUE, PAIR, FST, SND, ECHOADD, ECHOEQ) absent → Warning 8 promoted to error. Fixed with print_string "<NAME>" mirroring adjacent cases.

Also extends the TG-4 round-trip corpus (test_roundtrip.ml) with one entry per echo constructor so the parse(pretty(e)) = e guarantee is explicitly exercised for every form added by #45.

Test plan

  • dune build — was failing before this PR; passes after
  • dune test — 548/548 pass (16 new TG-4 echo entries; all prior suites unchanged)
  • Echo TG-4 round-trips: echoClose, lower, residue, pair, fst, snd, echoAdd, echoEq — all PASS

🤖 Generated with Claude Code

Two warnings-as-errors surfaced when compiling the echo/product additions
for the first time on a real OCaml toolchain:

  compiler/lib/typecheck.ml — `strand_type_of_ty` had no arms for TProd/TEcho.
  compiler/bin/main.ml     — the debug token printer had no arms for the 8 new
                             echo keyword tokens (ECHOCLOSE LOWER RESIDUE PAIR
                             FST SND ECHOADD ECHOEQ).

Both are straightforward exhaustiveness gaps; the design is preserved.
Both get StrandDefault / print_string "<NAME>" mirroring the nearest
neighbouring cases.

Also extend the TG-4 round-trip corpus in test_roundtrip.ml with one entry
per new echo constructor (echoClose, lower, residue, pair, fst, snd, echoAdd,
echoEq) so the parse/pretty/parse round-trip guarantee is explicitly exercised
for every form added by this PR.

Before: dune build fails; 532 tests (not reached)
After:  dune build succeeds; 548/548 tests pass (16 new TG-4 entries)
@hyperpolymath hyperpolymath merged commit 67b50f6 into main Jun 14, 2026
11 of 12 checks passed
@hyperpolymath hyperpolymath deleted the fix/echo-build-exhaustiveness branch June 14, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant