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

RedundantParens removes parens that are not redundant #4117

Closed
agilesteel opened this issue Jul 25, 2024 · 1 comment
Closed

RedundantParens removes parens that are not redundant #4117

agilesteel opened this issue Jul 25, 2024 · 1 comment

Comments

@agilesteel
Copy link

agilesteel commented Jul 25, 2024

version = "3.8.3"
maxColumn = 100
rewrite.rules = [ RedundantParens ]
runner.dialect = scala213

Steps

Given code like this:

object a {
  val b: Long = 1
}

(-a.b).toString

Problem

Scalafmt formats code like this:

-a.b.toString

Parens are removed and the code doesn't compile with

value unary_- is not a member of String

Expectation

I would like the formatted output to look like this:

(-a.b).toString // untouched

Workaround

Revert to v3.8.2 or disable formatting.

Note

This also happens in Scala3.

@kitbellew
Copy link
Collaborator

duplicate of #4116.

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

No branches or pull requests

2 participants