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

Alternatives within typespec argument lists are always split over multiple lines #89

Closed
ehamberg opened this issue Aug 5, 2020 · 4 comments · Fixed by #90
Closed

Alternatives within typespec argument lists are always split over multiple lines #89

ehamberg opened this issue Aug 5, 2020 · 4 comments · Fixed by #90
Assignees
Labels
bug Something isn't working

Comments

@ehamberg
Copy link

ehamberg commented Aug 5, 2020

erlfmt 0.5.0

(This might be related to #53.)

When formatting with 0.5.0 (after upgrading from 0.4.2), I saw a surprising number of changed files, and it turns out that the changes are typespecs' arguments list where alternatives now always are split over several lines:

 -spec use_credit(
     store:id(),
     decimal:decimal(),
-    binary() | null,
-    credit | {refund | dispute, binary()},
-    binary() | null
+    binary() |
+    null,
+    credit |
+    {refund | dispute, binary()},
+    binary() |
+    null
 ) -> ok.

Is this intentional? I would expect e.g. binary() | null to be left on a single line here like in 0.4.2, so this code would remain like this:

 -spec use_credit(
     store:id(),
     decimal:decimal(),
     binary() | null,
     credit | {refund | dispute, binary()},
     binary() | null
 ) -> ok.

In #53, what happened was that a sequence of alternatives (|) needed to be split over multiple lines, and then all alternatives should be on separate lines, but in this case, it's the arguments (,) that need to be split into separate lines, not the alternatives within an argument.

Hope this made sense. 😄

@michalmuskala michalmuskala added the bug Something isn't working label Aug 5, 2020
@michalmuskala
Copy link
Member

Thank you for trying erlfmt out! Yes, that definitely looks like a bug

@awalterschulze
Copy link
Contributor

And thank you @ehamberg for reporting so quickly :)

@ehamberg
Copy link
Author

ehamberg commented Aug 5, 2020

Happy to help! I’m just really happy this project exists! 😄

@michalmuskala
Copy link
Member

The fix is released in version 0.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants