We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
-Xsource:3
build.sbt
scalaVersion := "2.13.8" semanticdbEnabled := true scalacOptions ++= Seq("-Wunused", "-Xsource:3")
project/build.properties
sbt.version=1.7.1
project/plugins.sbt
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
Main.scala
import scala.collection.mutable import scala.util._ import scala.io.* object Main
run: sbt "scalafix RemoveUnused"
sbt "scalafix RemoveUnused"
log
[warn] /Users/kenji/remove-unused-scala-3-syntax/Main.scala:1:25: Unused import [warn] import scala.collection.mutable [warn] ^ [warn] /Users/kenji/remove-unused-scala-3-syntax/Main.scala:2:19: Unused import [warn] import scala.util._ [warn] ^ [warn] /Users/kenji/remove-unused-scala-3-syntax/Main.scala:3:17: Unused import [warn] import scala.io.* [warn] ^ [warn] three warnings found [info] Running scalafix on 1 Scala sources [success] Total time: 3 s, completed Aug 31, 2022, 4:36:11 AM
diff
@@ -1,5 +1,4 @@ -import scala.collection.mutable -import scala.util._ + import scala.io.*
remove import scala.io.*
import scala.io.*
The text was updated successfully, but these errors were encountered:
note: different position if Scala 3 style wildcard 🤔
import scala.io.* ^^^^^^^^^^^^^^^^^
import scala.util._ ^
--- a/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala +++ b/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala @@ -65,6 +65,7 @@ class RemoveUnused(config: RemoveUnusedConfig) doc.diagnostics.foreach { diagnostic => if (config.imports && diagnostic.message == "Unused import") { + println(diagnostic) isUnusedImport += diagnostic.position ``
Sorry, something went wrong.
scalafix/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala
Line 135 in f7944df
Maybe isUnusedImport(importPosition(i)) return false if Scala 3 style wildcard.
isUnusedImport(importPosition(i))
false
leverage testkit for -Xsource:3 test
39922fb
scalacenter#1663
Successfully merging a pull request may close this issue.
step
build.sbt
project/build.properties
sbt.version=1.7.1
project/plugins.sbt
Main.scala
run:
sbt "scalafix RemoveUnused"
actual
log
diff
expect
remove
import scala.io.*
The text was updated successfully, but these errors were encountered: