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

run RemoveUnused #1922

Merged
merged 1 commit into from
Feb 4, 2024
Merged

run RemoveUnused #1922

merged 1 commit into from
Feb 4, 2024

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented Feb 3, 2024

Follows #1918, #1728 & #1800

@@ -1,7 +1,6 @@
package scalafix.internal.patch

import scala.annotation.tailrec
import scala.collection.compat._
Copy link
Collaborator Author

@bjaglin bjaglin Feb 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This false positive comes from the Scala3 run:

[warn] Failed to parse `-Wconf` configuration: origin=scala.collection.compat.*:s

Copy link
Collaborator Author

@bjaglin bjaglin Feb 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to either revisit #1797, revert it or stop running RemoveUnused on Scala 3 for projects that use scala.collection.compat.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up patching NoAutoTupling.scala & EscapeHatch.scala as they didn't make a critical usage of scala.collection.compat.

@@ -28,9 +28,9 @@ trait TypeToTreeInput {
def r(vararg: String*): String
def s[c[x] <: Seq[x]](e: c[String]): c[Int]
type S = Functor[({ type T[A] = Either[Int, A] })#T]
private def t1: Unit = ()
Copy link
Collaborator Author

@bjaglin bjaglin Feb 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file to be ignored via //scalafix: off

@bjaglin bjaglin force-pushed the addremoveunused branch 4 times, most recently from 7ba3294 to 2f8744e Compare February 4, 2024 10:43
@@ -169,7 +169,6 @@ trait BaseCliSuite extends AnyFunSuite with DiffAssertions {
files: String = removeImportsPath.toString()
): Unit = {
test(name, SkipWindows) {
val fileIsFixed = expectedExit.isOk
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused + no side effect -> line removed manually


class ExplicitSynthetic() extends SemanticRule("ExplicitSynthetic") {
import scalafix.v1._
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in Scala3, the SemanticRule reference above is found thanks to this, making the top-level import unused. To get a consistent behavior across Scala versions, I just hoisted them.

@bjaglin bjaglin marked this pull request as ready for review February 4, 2024 11:04
@bjaglin bjaglin merged commit 90e404a into scalacenter:main Feb 4, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

1 participant