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

RemoveUnused: Expression parentheses not properly handled after removing unused variable #2061

Open
nox213 opened this issue Aug 30, 2024 · 1 comment

Comments

@nox213
Copy link

nox213 commented Aug 30, 2024

Removing an unused variable with Scalafix’s RemoveUnused rule leaves unbalanced parentheses in expressions, resulting in invalid syntax.

scala version: 2.13.13
sbt version: 1.10.1
scalafix version: 0.12.1

build.sbt

ThisBuild / scalaVersion := "2.13.13"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision

lazy val root = (project in file("."))
  .settings(
    name := "Test",
    scalacOptions += {
      "-Wunused:locals"
    }
  )

Before

object Main {
  def main(args: Array[String]): Unit = {
    val a: Int =
      (3
        + 4)
  }
}

After

object Main {
  def main(args: Array[String]): Unit = {
    3
        + 4)
  }
}
@bjaglin
Copy link
Collaborator

bjaglin commented Aug 31, 2024

Thanks for the great bug report! I'll try to look at it in the coming days.

@nox213 nox213 changed the title Partial removal of multiline expressions with RemoveUnused rule Scalafix RemoveUnused: Expression Parentheses Not Properly Handled After Removing Unused Variable Sep 10, 2024
@nox213 nox213 changed the title Scalafix RemoveUnused: Expression Parentheses Not Properly Handled After Removing Unused Variable RemoveUnused: Expression Parentheses Not Properly Handled After Removing Unused Variable Sep 10, 2024
@nox213 nox213 changed the title RemoveUnused: Expression Parentheses Not Properly Handled After Removing Unused Variable RemoveUnused: Expression parentheses not properly handled after removing unused variable Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants