From b5824873fe7f9362b1359639644ce2222d664afd Mon Sep 17 00:00:00 2001 From: Brice Jaglin Date: Tue, 27 Feb 2024 00:31:10 +0100 Subject: [PATCH] support upcoming 3.3.4 for unused warnings https://github.com/lampepfl/dotty/pull/17835#issuecomment-1960291826 --- .../main/scala/scalafix/internal/rule/OrganizeImports.scala | 6 +++--- .../main/scala/scalafix/internal/rule/RemoveUnused.scala | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala b/scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala index 6a0aff93f3..7ab1310051 100644 --- a/scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala +++ b/scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala @@ -864,7 +864,7 @@ object OrganizeImports { scalaVersion: String ): Configured[Rule] = { val hasCompilerSupport = - Seq("3.0", "3.1", "3.2", "3.3") + Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3") .forall(v => !scalaVersion.startsWith(v)) val hasWarnUnused = hasCompilerSupport && { @@ -916,12 +916,12 @@ object OrganizeImports { "A Scala compiler option is required to use OrganizeImports with" + " \"OrganizeImports.removeUnused\" set to true. To fix this problem, update your" + " build to add `-Ywarn-unused` (2.12), `-Wunused:imports` (2.13), or" - + " `-Wunused:import` (3.4+)." + + " `-Wunused:import` (3.3.4+ or 3.4+)." ) else Configured.error( "\"OrganizeImports.removeUnused\"" + s"is not supported on $scalaVersion as the compiler is" - + " not providing enough information. Please upgrade the Scala compiler to 3.4.0 or greater." + + " not providing enough information. Please upgrade the Scala compiler to 3.3.4+ or 3.4+." + " Otherwise, run the rule with \"OrganizeImports.removeUnused\" set to false" + " to organize imports while keeping potentially unused imports." ) diff --git a/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala b/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala index 3626c7a408..355c396cf9 100644 --- a/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala +++ b/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala @@ -33,7 +33,7 @@ class RemoveUnused(config: RemoveUnusedConfig) private def warnUnusedString = List("-Xlint", "-Xlint:unused") override def withConfiguration(config: Configuration): Configured[Rule] = { val diagnosticsAvailableInSemanticdb = - Seq("3.0", "3.1", "3.2", "3.3") + Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3") .forall(v => !config.scalaVersion.startsWith(v)) val hasWarnUnused = config.scalacOptions.exists(option => @@ -44,11 +44,11 @@ class RemoveUnused(config: RemoveUnusedConfig) Configured.error( """|A Scala compiler option is required to use RemoveUnused. To fix this problem, |update your build to add -Ywarn-unused (with 2.12), -Wunused (with 2.13), or - |-Wunused:all (with 3.4+)""".stripMargin + |-Wunused:all (with 3.3.4+ or 3.4+)""".stripMargin ) } else if (!diagnosticsAvailableInSemanticdb) { Configured.error( - "You must use a more recent version of the Scala 3 compiler (3.4+)" + "You must use a more recent version of the Scala 3 compiler (3.3.4+ or 3.4+)" ) } else { config.conf