Skip to content

Commit

Permalink
Merge pull request #2088 from bjaglin/scala360rc1
Browse files Browse the repository at this point in the history
build with and test against Scala 3.6.2
  • Loading branch information
bjaglin authored Dec 23, 2024
2 parents 6365c36 + e084367 commit a18fe12
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 24 deletions.
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ lazy val interfaces = project
props.put("scalafixVersion", version.value)
props.put("scalafixStableVersion", stableVersion.value)
props.put("scalametaVersion", scalametaV)
props.put("scala213", scala213)
props.put("scala212", scala212)
props.put("scala213", scala213)
props.put("scala33", scala33)
props.put("scala35", scala35)
props.put("scala36", scala36)
props.put("scala3LTS", scala3LTS)
props.put("scala3Next", scala3Next)
val out =
Expand Down
7 changes: 5 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import sbt._
object Dependencies {
val scala212 = sys.props.getOrElse("scala212.nightly", "2.12.20")
val scala213 = sys.props.getOrElse("scala213.nightly", "2.13.15")
val scala3Next = sys.props.getOrElse("scala3.nightly", "3.5.2")
val scala3LTS = "3.3.4"
val scala33 = "3.3.4"
val scala35 = "3.5.2"
val scala36 = "3.6.2"
val scala3LTS = scala33
val scala3Next = sys.props.getOrElse("scala3.nightly", scala36)

val bijectionCoreV = "0.9.8"
val collectionCompatV = "2.12.0"
Expand Down
5 changes: 4 additions & 1 deletion project/Mima.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ object Mima {
ProblemFilters.exclude[Problem]("scalafix.internal.*"),
ProblemFilters.exclude[Problem]("scala.meta.internal.*"),
// Exceptions
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.v0.Signature#Self.syntax")
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.v0.Signature#Self.syntax"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.Scalafix.scala33"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.Scalafix.scala35"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.Scalafix.scala36")
)
}
}
48 changes: 33 additions & 15 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {

// https://github.com/scalameta/scalameta/issues/2485
lazy val coreScalaVersions = Seq(scala212, scala213)
lazy val cliScalaVersions = Seq(scala212, scala213, scala3LTS, scala3Next)
lazy val cliScalaVersions = Seq(
scala212,
scala213,
scala33,
scala35,
scala36,
scala3Next
).distinct
lazy val cliScalaVersionsWithTargets: Seq[(String, TargetAxis)] =
cliScalaVersions.map(sv => (sv, TargetAxis(sv))) ++
Seq(scala213, scala212).flatMap { sv =>
Expand Down Expand Up @@ -138,6 +145,9 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"supportedScalaVersions" -> cliScalaVersions,
"scala212" -> scala212,
"scala213" -> scala213,
"scala33" -> scala33,
"scala35" -> scala35,
"scala36" -> scala36,
"scala3LTS" -> scala3LTS,
"scala3Next" -> scala3Next,
sbtVersion
Expand Down Expand Up @@ -230,8 +240,9 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
developers ++= Developers.list
)

private val PreviousScalaVersion: Map[String, String] = Map(
"3.5.2" -> "3.5.1"
private val PreviousScalaVersion: Map[String, Option[String]] = Map(
"3.5.2" -> Some("3.5.1"),
"3.6.2" -> None
)

override def buildSettings: Seq[Setting[_]] = List(
Expand Down Expand Up @@ -270,15 +281,15 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
// avoid "missing dependency" on artifacts with full scala version when bumping scala
versionPolicyIgnored ++= {
PreviousScalaVersion.get(scalaVersion.value) match {
case Some(previous) =>
case Some(Some(previous)) =>
// all transitive dependencies with full scala version we know about
Seq(
"org.scalameta" % s"semanticdb-scalac-core_$previous",
"ch.epfl.scala" % s"scalafix-cli_$previous",
"ch.epfl.scala" % s"scalafix-reflect_$previous",
"ch.epfl.scala" % s"scalafix-rules_$previous"
)
case None => Seq()
case _ => Seq()
}
},
versionPolicyIntention := Compatibility.BinaryCompatible,
Expand Down Expand Up @@ -309,16 +320,23 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
),
mimaPreviousArtifacts := {
val currentScalaFullV = scalaVersion.value
val previousScalaFullV =
PreviousScalaVersion.getOrElse(currentScalaFullV, currentScalaFullV)
val previousScalaVCrossName = CrossVersion(
crossVersion.value,
previousScalaFullV,
scalaBinaryVersion.value
).getOrElse(identity[String] _)(moduleName.value)
Set(
organizationName.value % previousScalaVCrossName % stableVersion.value
)
val maybePreviousScalaFullV =
PreviousScalaVersion.get(currentScalaFullV) match {
case Some(Some(previous)) => Some(previous)
case None => Some(currentScalaFullV)
case _ => None
}

maybePreviousScalaFullV.fold(Set.empty[ModuleID]) { previousScalaFullV =>
val previousScalaVCrossName = CrossVersion(
crossVersion.value,
previousScalaFullV,
scalaBinaryVersion.value
).getOrElse(identity[String] _)(moduleName.value)
Set(
organizationName.value % previousScalaVCrossName % stableVersion.value
)
}
},
mimaBinaryIssueFilters ++= Mima.ignoredABIProblems
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ final class ScalafixImpl extends Scalafix {
Versions.scala212
override def scala213(): String =
Versions.scala213
override def scala33(): String =
Versions.scala33
override def scala35(): String =
Versions.scala35
override def scala36(): String =
Versions.scala36
override def scala3LTS(): String =
Versions.scala3LTS
override def scala3Next(): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ public interface Scalafix {
*/
String scala213();

/**
* The Scala 3.3 version in {@link #supportedScalaVersions()}
*/
String scala33();

/**
* The Scala 3.5 version in {@link #supportedScalaVersions()}
*/
String scala35();

/**
* The Scala 3.6 version in {@link #supportedScalaVersions()}
*/
String scala36();

/**
* The Scala 3 LTS version in {@link #supportedScalaVersions()}
*/
Expand Down Expand Up @@ -135,7 +150,11 @@ static Scalafix fetchAndClassloadInstance(String requestedScalaVersion, List<Rep
requestedScalaMajorMinorOrMajorVersion.equals("3.1") ||
requestedScalaMajorMinorOrMajorVersion.equals("3.2") ||
requestedScalaMajorMinorOrMajorVersion.equals("3.3")) {
scalaVersionKey = "scala3LTS";
scalaVersionKey = "scala33";
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.5")) {
scalaVersionKey = "scala35";
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.6")) {
scalaVersionKey = "scala36";
} else if (requestedScalaMajorMinorOrMajorVersion.startsWith("3")) {
scalaVersionKey = "scala3Next";
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
rules = ExplicitResultTypes
ExplicitResultTypes.skipSimpleDefinitions = false
*/
package test.explicitResultTypes

trait Order[T]:
extension (values: Seq[T]) def toSorted: Seq[T] = ???
def compare(x: T, y: T): Int

given Order[Int]:
def compare(x: Int, y: Int) = ???

given listOrdering: [T: Order as elementOrder] => Order[List[T]]:
def compare(x: List[T], y: List[T]) = elementOrder.compare(x.head, y.head)
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class ScalafixSuite extends AnyFunSuite {
assert(api.scalametaVersion() == Versions.scalameta)
assert(api.scala212() == Versions.scala212)
assert(api.scala213() == Versions.scala213)
assert(api.scala33() == Versions.scala33)
assert(api.scala35() == Versions.scala35)
assert(api.scala36() == Versions.scala36)
assert(api.scala3LTS() == Versions.scala3LTS)
assert(api.scala3Next() == Versions.scala3Next)
assert(
Expand Down Expand Up @@ -113,13 +116,23 @@ class ScalafixSuite extends AnyFunSuite {
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
}

test("classload Scala 3 Next with full post-LTS version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.4.0", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3Next)
test("classload Scala 3.5 with full version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.5.2", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala35)
}

test("classload Scala 3 Next with major.minor post-LTS version") {
test("classload Scala 3.5 with major.minor version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.5", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala35)
}

test("classload Scala 3 Next with full version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.6.2", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3Next)
}

test("classload Scala 3 Next with major.minor version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.6", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3Next)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package test.explicitResultTypes

trait Order[T]:
extension (values: Seq[T]) def toSorted: Seq[T] = ???
def compare(x: T, y: T): Int

given Order[Int]:
def compare(x: Int, y: Int): Int = ???

given listOrdering: [T: Order as elementOrder] => Order[List[T]]:
def compare(x: List[T], y: List[T]): Int = elementOrder.compare(x.head, y.head)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class InterfacesPropertiesSuite extends AnyFunSuite with BeforeAndAfterAll {
check("scalametaVersion", Versions.scalameta)
check("scala212", Versions.scala212)
check("scala213", Versions.scala213)
check("scala33", Versions.scala33)
check("scala35", Versions.scala35)
check("scala36", Versions.scala36)
check("scala3LTS", Versions.scala3LTS)
check("scala3Next", Versions.scala3Next)

Expand Down

0 comments on commit a18fe12

Please sign in to comment.