mirror of https://github.com/sbt/sbt.git
Fix dependency-management/stdlib-unfreeze
This commit is contained in:
parent
c3d6bfeaa4
commit
a116a477c9
|
|
@ -1,16 +1,24 @@
|
||||||
import scala.quoted.* // imports Quotes, Expr
|
import scala.quoted.* // imports Quotes, Expr
|
||||||
|
|
||||||
package scala.collection {
|
package scala.collection.immutable {
|
||||||
object Exp:
|
object Exp {
|
||||||
// added in 2.13.10, not available in 2.13.8
|
// Access RedBlackTree.validate and Tree class added in Scala 2.13.13
|
||||||
def m(i: Int) = IterableOnce.checkArraySizeWithinVMLimit(i)
|
// Scala 3.3.4 uses Scala 2.13.14 library
|
||||||
|
// Scala 3.3.2 uses Scala 2.13.12 library
|
||||||
|
// Hence RedBlackTree.validate is available in 3.3.4 but not in 3.3.2
|
||||||
|
// c.c. https://mvnrepository.com/artifact/org.scala-lang/scala3-library_3/3.3.2
|
||||||
|
// c.c. https://mvnrepository.com/artifact/org.scala-lang/scala3-library_3/3.3.4
|
||||||
|
def validateTree[A](tree: RedBlackTree.Tree[A, _])(implicit ordering: Ordering[A]): tree.type = {
|
||||||
|
RedBlackTree.validate(tree)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Mac:
|
object Mac:
|
||||||
inline def inspect(inline x: Any): Any = ${ inspectCode('x) }
|
inline def inspect(inline x: Any): Any = ${ inspectCode('x) }
|
||||||
|
|
||||||
def inspectCode(x: Expr[Any])(using Quotes): Expr[Any] =
|
def inspectCode(x: Expr[Any])(using Quotes): Expr[Any] =
|
||||||
scala.collection.Exp.m(42)
|
scala.collection.immutable.Exp.validateTree(null)(null)
|
||||||
println(x.show)
|
println(x.show)
|
||||||
x
|
x
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
import sbt.librarymanagement.InclExclRule
|
import sbt.librarymanagement.InclExclRule
|
||||||
|
|
||||||
lazy val a = project.settings(
|
lazy val a = project.settings(
|
||||||
scalaVersion := "2.13.6",
|
scalaVersion := "2.13.11",
|
||||||
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
||||||
TaskKey[Unit]("checkLibs") := checkLibs("2.13.6", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
TaskKey[Unit]("checkLibs") := checkLibs("2.13.11", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val b = project.dependsOn(a).settings(
|
lazy val b = project.dependsOn(a).settings(
|
||||||
scalaVersion := "2.13.8",
|
scalaVersion := "2.13.12",
|
||||||
TaskKey[Unit]("checkLibs") := checkLibs("2.13.8", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
TaskKey[Unit]("checkLibs") := checkLibs("2.13.12", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val a3 = project.settings(
|
lazy val a3 = project.settings(
|
||||||
scalaVersion := "3.2.2", // 2.13.10 library
|
scalaVersion := "3.3.4", // 2.13.14 library
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val b3 = project.dependsOn(a3).settings(
|
lazy val b3 = project.dependsOn(a3).settings(
|
||||||
scalaVersion := "3.2.0", // 2.13.8 library
|
scalaVersion := "3.3.2", // 2.13.12 library
|
||||||
TaskKey[Unit]("checkScala") := {
|
TaskKey[Unit]("checkScala") := {
|
||||||
val i = scalaInstance.value
|
val i = scalaInstance.value
|
||||||
i.libraryJars.filter(_.toString.contains("scala-library")).toList match {
|
i.libraryJars.filter(_.toString.contains("scala-library")).toList match {
|
||||||
case List(l) => assert(l.toString.contains("2.13.10"), i.toString)
|
case List(l) => assert(l.toString.contains("2.13.14"), i.toString)
|
||||||
}
|
}
|
||||||
assert(i.compilerJars.filter(_.toString.contains("scala-library")).isEmpty, i.toString)
|
assert(i.compilerJars.filter(_.toString.contains("scala-library")).isEmpty, i.toString)
|
||||||
assert(i.otherJars.filter(_.toString.contains("scala-library")).isEmpty, i.toString)
|
assert(i.otherJars.filter(_.toString.contains("scala-library")).isEmpty, i.toString)
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,17 @@
|
||||||
> b/checkLibs
|
> b/checkLibs
|
||||||
|
|
||||||
> b/run
|
> b/run
|
||||||
$ exists s2.13.8.txt
|
$ exists s2.13.12.txt
|
||||||
$ delete s2.13.8.txt
|
$ delete s2.13.12.txt
|
||||||
|
|
||||||
# don't crash when expanding the macro
|
# don't crash when expanding the macro
|
||||||
> b3/run
|
> b3/run
|
||||||
$ exists s2.13.10.txt
|
$ exists s2.13.14.txt
|
||||||
$ delete s2.13.10.txt
|
$ delete s2.13.14.txt
|
||||||
|
|
||||||
> b3/checkScala
|
> b3/checkScala
|
||||||
|
|
||||||
# without the default `csrSameVersions`, scala-reflect in b stays at 2.13.6
|
# without the default `csrSameVersions`, scala-reflect in b stays at 2.13.11
|
||||||
> set b/csrSameVersions := Nil
|
> set b/csrSameVersions := Nil
|
||||||
> b/update
|
> b/update
|
||||||
-> b/checkLibs
|
-> b/checkLibs
|
||||||
Loading…
Reference in New Issue