Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses in type signatures do not seem to be handled at all #818

Open
Niols opened this issue Dec 29, 2024 · 2 comments
Open

Parentheses in type signatures do not seem to be handled at all #818

Niols opened this issue Dec 29, 2024 · 2 comments
Labels
language: ocaml OCaml formatting issues P2 major: an upcoming release type: bug

Comments

@Niols
Copy link
Member

Niols commented Dec 29, 2024

As of f35eee4, Topiary formats:

val foo :
  named_argument: (
    int ->
    float ->
    string
  ) ->
  other_argument ->
  result

as:

val foo :
  named_argument:
  (int ->
  float ->
  string) ->
  other_argument ->
  result

which is just... wrong. I'm not sure my snippet is how Topiary should render it, but at least it should definitely render it how it does it now.

Somewhat related to dangling parentheses: #661

To reproduce:

$ nix run github:tweag/topiary/f35eee4 -- format -l ocaml_interface <<EOF
val foo :
  named_argument: (
    int ->
    float ->
    string
  ) ->
  other_argument ->
  result
EOF
@Niols Niols added P2 major: an upcoming release type: bug language: ocaml OCaml formatting issues labels Dec 29, 2024
@Niols
Copy link
Member Author

Niols commented Dec 29, 2024

Note that this isn't limited to named arguments (it is just how I discovered it):

val foo :
  (        
    int ->
    float ->
    string
  ) ->
  other_argument ->
  result           

gets formatted as

val foo :
  (int ->
  float ->
  string) ->
  other_argument ->
  result

@Niols
Copy link
Member Author

Niols commented Dec 29, 2024

Also, combo with #816:

val foo :
  named_argument:
    (
      int,
      string
    )
      Hashtbl.t ->
  other_argument ->
  result

gets formatted as

val foo :
  named_argument:
  (int, string) Hashtbl.t ->
  other_argument ->
  result

Again, my snippet doesn't look good so I'm not sure how things should look, but not like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language: ocaml OCaml formatting issues P2 major: an upcoming release type: bug
Projects
None yet
Development

No branches or pull requests

1 participant