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

Spacing in single-line records #729

Closed
Niols opened this issue Sep 6, 2024 · 2 comments · Fixed by #735
Closed

Spacing in single-line records #729

Niols opened this issue Sep 6, 2024 · 2 comments · Fixed by #735
Labels
language: ocaml OCaml formatting issues P3 minor: not priorized type: bug

Comments

@Niols
Copy link
Member

Niols commented Sep 6, 2024

As of 1720fa9, Topiary formats:

[a; b; c]
;;
[|a; b; c|]
;;
{a; b; c}
;;
type x = [`Foo | `Bar]
;;
type x = [> `Foo | `Bar]
;;
type x = [< `Foo | `Bar]
;;
type x = {a: int; b: int; c: int}

as

[a; b; c]
;;
[|a; b; c|]
;;
{ a; b; c }
;;
type x = [`Foo | `Bar]
;;
type x = [> `Foo | `Bar]
;;
type x = [< `Foo | `Bar]
;;
type x = { a: int; b: int; c: int }

Note how the record, both value and type, is the only one that gets extra spacing. It would be worth making this consistent. I think we should go for no spaces.

@Niols Niols added type: bug P3 minor: not priorized language: ocaml OCaml formatting issues labels Sep 6, 2024
@Niols
Copy link
Member Author

Niols commented Sep 6, 2024

Note that this also happens in patterns:

match foo with
| {bar; baz} -> bar + baz
| Qux {quux} -> quux

gets formatted as

match foo with
| { bar; baz } -> bar + baz
| Qux { quux } -> quux

@Niols
Copy link
Member Author

Niols commented Sep 6, 2024

let foo {bar; baz} (Qux {quux}) =
  bar + baz - quux

->

let foo { bar; baz } (Qux { quux }) =
  bar + baz - quux

(At least, the whole thing is very consistent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language: ocaml OCaml formatting issues P3 minor: not priorized type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant