Skip to content

Commit ad0de52

Browse files
authored
Display all supported scalaVersions for ExplicitResultType (#1194)
1 parent c5817c6 commit ad0de52

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: build.sbt

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ lazy val rules = project
7474
buildInfoKeys ++= Seq[BuildInfoKey](
7575
"supportedScalaVersions" -> (scalaVersion.value +:
7676
testedPreviousScalaVersions
77-
.getOrElse(scalaVersion.value, Nil))
77+
.getOrElse(scalaVersion.value, Nil)),
78+
"allSupportedScalaVersions" -> ((crossScalaVersions.value ++ testedPreviousScalaVersions.values.toSeq.flatten).sorted)
7879
),
7980
buildInfoObject := "RulesBuildInfo",
8081
description := "Built-in Scalafix rules",

Diff for: scalafix-rules/src/main/scala/scalafix/internal/rule/ExplicitResultTypes.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ final class ExplicitResultTypes(
1818
) extends SemanticRule("ExplicitResultTypes") {
1919

2020
def this() = this(ExplicitResultTypesConfig.default, LazyValue.now(None))
21-
val supportedScalaVersions = RulesBuildInfo.supportedScalaVersions
22-
val compilerScalaVersion = RulesBuildInfo.scalaVersion
21+
val supportedScalaVersions: collection.Seq[String] =
22+
RulesBuildInfo.supportedScalaVersions
23+
val compilerScalaVersion: String = RulesBuildInfo.scalaVersion
2324

2425
private def toBinaryVersion(v: String) = v.split('.').take(2).mkString(".")
2526

2627
override def description: String =
2728
"Inserts type annotations for inferred public members. " +
28-
s"Only compatible with Scala ${supportedScalaVersions.mkString(",")}."
29+
s"Only compatible with Scala ${RulesBuildInfo.allSupportedScalaVersions.mkString(", ")}."
2930
override def isRewrite: Boolean = true
3031

3132
override def afterComplete(): Unit = {

0 commit comments

Comments
 (0)