Skip to content

Commit 21db4ae

Browse files
committed
support upcoming 3.3.4 for unused warnings
scala/scala3#17835 (comment)
1 parent f354dae commit 21db4ae

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ object OrganizeImports {
864864
scalaVersion: String
865865
): Configured[Rule] = {
866866
val hasCompilerSupport =
867-
Seq("3.0", "3.1", "3.2", "3.3")
867+
Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3")
868868
.forall(v => !scalaVersion.startsWith(v))
869869

870870
val hasWarnUnused = hasCompilerSupport && {
@@ -915,13 +915,14 @@ object OrganizeImports {
915915
else if (hasCompilerSupport)
916916
Configured.error(
917917
"A Scala compiler option is required to use OrganizeImports with"
918-
+ " \"OrganizeImports.removeUnused\" set to true. To fix this problem, update your"
919-
+ " build to add `-Ywarn-unused-import` (2.12) or `-Wunused:imports` (2.13 and 3.4+)."
918+
+ " \"OrganizeImports.removeUnused\" set to true. To fix this"
919+
+ " problem, update your build to add `-Ywarn-unused-import` (2.12)"
920+
+ " or `-Wunused:imports` (2.13, 3.3.4+ and 3.4+)."
920921
)
921922
else
922923
Configured.error(
923924
"\"OrganizeImports.removeUnused\"" + s"is not supported on $scalaVersion as the compiler is"
924-
+ " not providing enough information. Please upgrade the Scala compiler to 3.4.0 or greater."
925+
+ " not providing enough information. Please upgrade the Scala compiler to 3.3.4+ or 3.4+."
925926
+ " Otherwise, run the rule with \"OrganizeImports.removeUnused\" set to false"
926927
+ " to organize imports while keeping potentially unused imports."
927928
)

scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RemoveUnused(config: RemoveUnusedConfig)
3333
private def warnUnusedString = List("-Xlint", "-Xlint:unused")
3434
override def withConfiguration(config: Configuration): Configured[Rule] = {
3535
val diagnosticsAvailableInSemanticdb =
36-
Seq("3.0", "3.1", "3.2", "3.3")
36+
Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3")
3737
.forall(v => !config.scalaVersion.startsWith(v))
3838

3939
val hasWarnUnused = config.scalacOptions.exists(option =>
@@ -44,11 +44,11 @@ class RemoveUnused(config: RemoveUnusedConfig)
4444
Configured.error(
4545
"""|A Scala compiler option is required to use RemoveUnused. To fix this problem,
4646
|update your build to add -Ywarn-unused (with 2.12), -Wunused (with 2.13), or
47-
|-Wunused:all (with 3.4+)""".stripMargin
47+
|-Wunused:all (with 3.3.4+ or 3.4+)""".stripMargin
4848
)
4949
} else if (!diagnosticsAvailableInSemanticdb) {
5050
Configured.error(
51-
"You must use a more recent version of the Scala 3 compiler (3.4+)"
51+
"You must use a more recent version of the Scala 3 compiler (3.3.4+ or 3.4+)"
5252
)
5353
} else {
5454
config.conf

0 commit comments

Comments
 (0)