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 not working properly with boolean ! unary operator #4142

Closed
acote-coveo opened this issue Aug 6, 2024 · 1 comment
Closed

Comments

@acote-coveo
Copy link

Configuration (required)

Please paste the smallest possible set of .scalafmt.conf
configuration parameters that reproduces the problem:

version = 3.8.3
runner.dialect = scala212

rewrite.rules = [RedundantParens]

Command-line parameters (required)

When I run scalafmt via CLI like this: scalafmt

Steps

Given code like this:

object Test {
  
  val boolean = true
  
  println(s"${(!boolean).toString}")
}

Problem

Scalafmt formats code like this:

object Test {

  val boolean = true

  println(s"${!boolean.toString}")
}

Expectation

I would like the formatted output to look like this:

object Test {
  
  val boolean = true
  
  println(s"${(!boolean).toString}")
}

Workaround

I can workaround that by either reverting the version (to 3.8.2) or removing the RedundantParens rewrite rules.

Notes

@kitbellew
Copy link
Collaborator

duplicate of #4117.

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