这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ccasin
Copy link

@ccasin ccasin commented Feb 9, 2023

Antal pointed out that:

let x = f ([| 1 |] [@foo])

is being misformatted as

let x = f [| 1 |] [@foo]

This PR fixes that. There are changes in two files (plus a test):

  • In Fmt_ast, the result of parenze_exp was being ignored for array literals. Now it isn't.
  • in Ast, the parenze_exp function was saying that array literals should be parenthesized too often, but this went unnoticed because its result was being ignored in Fmt_ast. Now it follows the same rules used for list literals.

This is an upstream bug. I'll submit a PR there too.

@ccasin ccasin requested a review from antalsz February 9, 2023 06:16
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Copy link

@antalsz antalsz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@antalsz antalsz merged commit 197f9f4 into oxcaml:jane Feb 9, 2023
@ccasin ccasin deleted the array-attr branch February 10, 2023 13:03
antalsz added a commit to antalsz/ocamlformat that referenced this pull request Feb 10, 2023
antalsz added a commit to antalsz/ocamlformat that referenced this pull request Feb 10, 2023
antalsz added a commit to antalsz/ocamlformat that referenced this pull request Feb 15, 2023
antalsz added a commit to antalsz/ocamlformat that referenced this pull request Feb 15, 2023
Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
ceastlund pushed a commit that referenced this pull request Feb 23, 2023
Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
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