Skip to content

Upgrade to Scala 3.8.0#459

Closed
mrdziuban wants to merge 7 commits intoscalacenter:mainfrom
mrdziuban:scala-3.8
Closed

Upgrade to Scala 3.8.0#459
mrdziuban wants to merge 7 commits intoscalacenter:mainfrom
mrdziuban:scala-3.8

Conversation

@mrdziuban
Copy link
Contributor

Upgrades to Scala 3.8.0 (which is currently being released: scala/scala3#24947) and 2.13.18 for Scala 2 tests. Also upgrades to Scala.js 1.20.1 to match the compiler upgrade in scala/scala3#23884.

There are still a handful of issues to address, see comments below.

Copy link
Contributor Author

@mrdziuban mrdziuban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still some test failures I'm not sure how to resolve, primarily mentioning issues like this:

tastyquery.Exceptions$MemberNotFoundException: Member ImpureFunction1/T not found in PackageRef(scala)

There are also some binary compatibility problems:

tasty-query: Failed binary compatibility check against ch.epfl.scala:tasty-query_3:1.6.1! Found 4 potential problems
 * static method <clinit>()Unit in object tastyquery.Names#Name does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("tastyquery.Names#Name.<clinit>")
 * static method <clinit>()Unit in object tastyquery.Signatures#Signature does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("tastyquery.Signatures#Signature.<clinit>")
 * static method <clinit>()Unit in object tastyquery.jdk.ClasspathLoaders#FileKind does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("tastyquery.jdk.ClasspathLoaders#FileKind.<clinit>")
 * static method <clinit>()Unit in object tastyquery.reader.classfiles.ClassfileReader#ConstantInfo does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("tastyquery.reader.classfiles.ClassfileReader#ConstantInfo.<clinit>")

Please let me know how you'd like to resolve these.


def readResourceCodeFile(relPath: String): String =
val path = getEnvVar(ResourceCodeEnvVar).nn + "/" + relPath
val path = getEnvVar(ResourceCodeEnvVar) + "/" + relPath
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the .nn removals are from spots where the compiler reported that it was unnecessary because the qualifier is already not null


lazy val scala3ClasspathIndex: Int =
classpathEntries.indexWhere(_.contains("scala3-library_3").nn)
classpathEntries.indexWhere(_.contains("scala-library-3"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, the tests in ClasspathEntrySuite fail with an error:

tastyquery.Exceptions$UnknownClasspathEntry: Unknown classpath entry: /Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.8.0/scala3-library_3-3.8.0.jar, it is probably from another Classpath.
    at tastyquery.Contexts$.tastyquery$Contexts$Context$$_$findSymbolsByClasspathEntry$$anonfun$1(Contexts.scala:91)
    at scala.Option.getOrElse(Option.scala:203)
    at tastyquery.Contexts$Context.findSymbolsByClasspathEntry(Contexts.scala:92)
    at tastyquery.ClasspathEntrySuite.lookupSyms(ClasspathEntrySuite.scala:15)
    at tastyquery.ClasspathEntrySuite.$init$$$anonfun$1(ClasspathEntrySuite.scala:20)
    at tastyquery.UnrestrictedUnpicklingSuite.testWithContext$$anonfun$1(UnrestrictedUnpicklingSuite.scala:14)
    at tastyquery.UnrestrictedUnpicklingSuite.testWithContext$$anonfun$2$$anonfun$1(UnrestrictedUnpicklingSuite.scala:25)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:503)
    at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
    at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
    at java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)


val syms = lookupSyms(scala3ClasspathEntry)

assert(syms.size < 300, s"scala 3 library has unexpected root symbols, found ${syms.size}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the Scala 3 library now does contain root symbols, so this assertion is no longer relevant

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the full context of the test, but scala-library.jar jar now has all Scala Standard Library definitions, scala3-library_3.jar is now an empty (POM-only) JAR file kept for binary compatibility.

Copy link
Contributor Author

@mrdziuban mrdziuban Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @WojciechMazur. That fact, combined with the change to look for scala-library-3 instead of scala3-library_3, makes it make sense why this assertion started failing on 3.8

assert(
clue(isSym.declaredType)
.isIntersectionOf(_.isRef(typeXSym), _.isApplied(_.isRef(ListClass), List(_.isRef(tTypeCaptureSym))))
.isIntersectionOf(_.isApplied(_.isRef(ListClass), List(_.isRef(tTypeCaptureSym))), _.isRef(typeXSym))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of these is just flipped

_.isType {
case lambda: TypeLambda => lambda.resultType.isApplied(_.isRef(ListClass), List(_ => true))
case _ => false
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This second type arg is the one that needed to change. I'm not 100% sure why, but _.isRef(ListClass) is no longer true. Instead it's now a TypeLambda

assert(clue(deprecatedAnnot.argIfConstant(0)).isDefined)
assert(clue(deprecatedAnnot.argIfConstant(1)) == Some(Constant("2.13.0")))

intercept[UnsupportedOperationException](deprecatedAnnot.annotConstructor)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is no longer an unsupported operation because the annotation isn't a Scala 2 annotation anymore

_.isType {
case lambda: TypeLambda => lambda.resultType.isApplied(_.isRef(IterableClass), List(_ => true))
case _ => false
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the _.isRef(ListClass) change above, this is now a TypeLambda

assert(
clue(mt.resultType)
.isApplied(_.isRef(AmpersandType), List(_ eq typeParamRef, _.isRef(EfficientSplitClass)))
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a good change. Should an AppliedType(scala.&, List(...)) be considered an AndType? It is not currently

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppliedType(scala.&, List(...)) is indeed not an AndType. scala.& is a polymorphic type alias to a magical right-hand-side that is an actual, "internal" & type. See https://www.scala-lang.org/files/archive/spec/3.4/12-the-scala-standard-library.html#fundamental-type-aliases

Developer("bishabosha", "Jamie Thompson", "bishbashboshjt@gmail.com", url("https://github.com/bishabosha")),
),
versionPolicyIntention := Compatibility.BinaryAndSourceCompatible,
versionPolicyIntention := Compatibility.BinaryCompatible,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be relaxed temporarily to allow the Scala and Scala.js upgrades

"-Werror",
"-Wsafe-init",
"-source:future",
// "-source:future",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this enabled would require 100+ syntactical changes, e.g. from if (pred) ... to if pred then ... and while (pred) ... to while pred do ....

I've commented it out for now to reduce noise in the diff. I'd be happy to follow up with the syntactical changes once this is merged.

@sjrd sjrd mentioned this pull request Jan 22, 2026
@sjrd
Copy link
Contributor

sjrd commented Jan 22, 2026

Superseded by #460 and #461, in which I have cherry-picked and squashed your commits. Thanks a lot for that work. It truly significantly reduced the time I had to spend on this.

@sjrd sjrd closed this Jan 22, 2026
@mrdziuban
Copy link
Contributor Author

Amazing, thank you! Would you like me to follow up with the syntax changes necessary to re-enable -source:future?

@sjrd
Copy link
Contributor

sjrd commented Jan 22, 2026

If you want, though I probably won't prioritize reviewing that in the coming weeks. I have other more pressing duties.

@mrdziuban mrdziuban deleted the scala-3.8 branch January 27, 2026 13:33
@mrdziuban
Copy link
Contributor Author

If you want, though I probably won't prioritize reviewing that in the coming weeks. I have other more pressing duties.

No problem, I just opened #463 for whenever you have a chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants