Skip to content

Pprintast: use parentheses around Pexp_struct_item in sequences#14008

Merged
gasche merged 3 commits intoocaml:trunkfrom
nojb:fix_pprint_struct_item_paren
May 2, 2025
Merged

Pprintast: use parentheses around Pexp_struct_item in sequences#14008
gasche merged 3 commits intoocaml:trunkfrom
nojb:fix_pprint_struct_item_paren

Conversation

@nojb
Copy link
Copy Markdown
Contributor

@nojb nojb commented May 2, 2025

A small bug fix following #13839: the treatment in Pprintast for the new Pexp_struct_item needs to be equivalent to Pexp_let in order to add parentheses correctly when these expressions appear in sequences.

@gasche
Copy link
Copy Markdown
Member

gasche commented May 2, 2025

We are looking at a bug that was facilitated by a catch-all pattern in a function that should be revisited on each new expression-former. I wish you would remove the catch-all pattern and replace it by a fixed list of cases.

@nojb
Copy link
Copy Markdown
Contributor Author

nojb commented May 2, 2025

I wish you would remove the catch-all pattern and replace it by a fixed list of cases.

I can get rid of the catch-all pattern, but note that it wouldn't have helped with this bug because the case that was missing an adaptation is guarded by a when clause (the "standalone" case for the new Pexp_struct_item had been correctly added in #13839).

@gasche
Copy link
Copy Markdown
Member

gasche commented May 2, 2025

I had missed the subtlety on the when clause. Then I support doing as you think is best, and I'll start by merging the PR as-is.

@gasche gasche merged commit 2b061de into ocaml:trunk May 2, 2025
22 checks passed
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.

2 participants