Skip to content

fix: allow formatting dialects for parser-generator inputs - #17193

Open
anmonteiro wants to merge 4 commits into
ocaml:mainfrom
anmonteiro:fix/parser-formatting-dialects
Open

anmonteiro wants to merge 4 commits into
ocaml:mainfrom
anmonteiro:fix/parser-formatting-dialects

Conversation

@anmonteiro

@anmonteiro anmonteiro commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Restore builds using formatting dialects for parser-generator inputs.

Fixes #17030 (regression from #16414). Extends #17029 and depends on #17194 (merge first).

01a20619-183b-76f3-b8a7-18c1b28eb1c0

@anmonteiro
anmonteiro marked this pull request as ready for review November 23, 2026 05:19
@anmonteiro
anmonteiro force-pushed the fix/parser-formatting-dialects branch from 10628da to b6d5762 Compare November 23, 2026 05:31
Cover ocaml#17030 for Menhir and ocamlyacc; complements ocaml#17029. Fixed by ocaml#17193.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Extend the reproduction from ocaml#17029 to exercise formatting. Refs ocaml#17030.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Recognize generated modules that share their original source with a dialect input. Fixes ocaml#17030, introduced by ocaml#16414; uses the reproduction from ocaml#17029.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
@anmonteiro
anmonteiro force-pushed the fix/parser-formatting-dialects branch from b6d5762 to 4bad995 Compare November 23, 2026 05:37
@Alizter

Alizter commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

The part I am unsure about is if this is something we even want to support. Should we consider .mll and mly as dialects at all? They aren't directly involved in OCaml compilation like reason files, so they are really on-the-fly source generation if anything.

The question I usually ask in these kinds of situations is: "Can we give users another reasonable way to do what they want?". In this case, writing formatting rules by hand is one such way, but quite unwieldy still.

@anmonteiro

Copy link
Copy Markdown
Collaborator Author

The part I am unsure about is if this is something we even want to support.

I agree with this -- I was interested in looking at what a fix would look like, and this PR should rather be a draft (converted now).

The other way that I've been looking at this one is that it's technically a breaking change, since it breaks the build for a project relying on it. That was the original impetus for seeing what the diff looked like -- it seems like enough of a small fix that has the benefit of restoring previously working behavior -- but let me know if you disagree.

anmonteiro added a commit that referenced this pull request Nov 23, 2026
Reproduce #17030 for Menhir and ocamlyacc formatting dialects.
Complements #17029; fixed by #17193.

01a20619-183b-76f3-b8a7-18c1b28eb1c0

Signed-off-by: Antonio Nuno Monteiro <[email protected]>

This branch has not been deployed

No deployments
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.

Dune 3.25 rejects formatting dialects for parser-generator inputs

2 participants