-
Notifications
You must be signed in to change notification settings - Fork 277
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
indentOperator
doesn't apply to union and intersection type expressions
#3153
Comments
@martingd what if you used scala213 dialect instead? will that be formatted differently? |
@kitbellew Does that make sense? Scala 2 does not have union types? I cannot compile this code with the Scala 2 compiler (even if I wrap it in an object).
|
@kitbellew But I tried anyway:
But the code is still not valid Scala 2. Isn't the reason it works that scalafmt sees this as a binary or operator and not a type union? |
scalafmt is not a compiler. it uses scalameta to parse the code, and for scala2 the parser produces a different tree which is handled correctly, which you confirmed for me. so, need to change the parser. |
@kitbellew I understand it's not a compiler. :) |
Configuration
Problem
Given the above configuration and given this code:
when I run scalafmt via CLI like this:
scalafmt test.scala --stdout
The output is:
Expectation
I would like the formatted output to keep its original indentation:
However, it seems the
indentOperator
configuration only applies to value expressions and not type expressions (e.g., union types).Workaround
None.
The text was updated successfully, but these errors were encountered: