This script does the following:
- Downloads the listing of Scala 3 nightly versions from https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/
- Parses and sorts them in a really silly way
- Runs binary search, invoking scala-cli with a given file and different versions, until it hits the earliest version where the file fails to compile
E.g. if you have a file like this (from scala/scala3#15160):
example.sc
trait Eq[A] {
def eqv(a1: A, a2: A): Boolean
}
given stringEq: Eq[String] with {
def eqv(a1: String, a2: String) = a1 == a2
}
abstract class Newtype[Src] {
opaque type Type = Src
protected final def derive[F[_]](using ev: F[Src]): F[Type] = ev
}
object Sample extends Newtype[String] {
given eq: Eq[Type] = derive
}
You can find the earliest known nightly version where this regressed by running the script directly from the gist:
$ scli https://gist.github.com/keynmol/4062482b5c06975df1f1b0607d472484 -- example.sc
Compiling project (Scala 3.1.2, JVM)
Warning: Flag -bootclasspath set repeatedly
Warning: Flag -classpath set repeatedly
Compiled project (Scala 3.1.2, JVM)
[0: 289, mid = 144] Evaluating 3.1.1-RC1-bin-20211006-40a1f44-NIGHTLY✅
[144: 289, mid = 216] Evaluating 3.1.3-RC1-bin-20220208-273ffc9-NIGHTLY❌
[144: 216, mid = 180] Evaluating 3.1.2-RC1-bin-20211210-c3f614b-NIGHTLY❌
[144: 180, mid = 162] Evaluating 3.1.2-RC1-bin-20211029-ad5c714-NIGHTLY✅
[162: 180, mid = 171] Evaluating 3.1.2-RC1-bin-20211123-ca483f8-NIGHTLY❌
[162: 171, mid = 166] Evaluating 3.1.2-RC1-bin-20211114-16f9b22-NIGHTLY❌
[162: 166, mid = 164] Evaluating 3.1.2-RC1-bin-20211102-82172ed-NIGHTLY✅
[164: 166, mid = 165] Evaluating 3.1.2-RC1-bin-20211112-4025951-NIGHTLY❌
3.1.2-RC1-bin-20211102-82172ed-NIGHTLY