Skip to content

Commit 0859ee9

Browse files
authored
Reuse -Yscala2Unpickler to check Scala 2 library compilation (#19430)
We want to make sure that the Scala 2 library JAR compiled with Scala 2 is not loaded when we compile the Scala 2 library TASTy. The `-Yscala2Unpickler:never` can be used to ensure this.
2 parents 459fe60 + 6430c31 commit 0859ee9

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
151151
assert(moduleRoot.isTerm)
152152

153153
checkVersion(using ictx)
154-
checkScala2Stdlib(using ictx)
155154

156155
private val loadingMirror = defn(using ictx) // was: mirrorThatLoaded(classRoot)
157156

@@ -238,9 +237,6 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
238237
" in " + source)
239238
}
240239

241-
private def checkScala2Stdlib(using Context): Unit =
242-
assert(!ctx.settings.YcompileScala2Library.value, "No Scala 2 libraries should be unpickled under -Ycompile-scala2-library")
243-
244240
/** The `decls` scope associated with given symbol */
245241
protected def symScope(sym: Symbol): Scope = symScopes.getOrElseUpdate(sym, newScope(0))
246242

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ object Build {
10631063
},
10641064
Compile / doc / scalacOptions += "-Ydocument-synthetic-types",
10651065
scalacOptions += "-Ycompile-scala2-library",
1066+
scalacOptions += "-Yscala2Unpickler:never",
10661067
scalacOptions -= "-Xfatal-warnings",
10671068
Compile / compile / logLevel := Level.Error,
10681069
ivyConfigurations += SourceDeps.hide,

0 commit comments

Comments
 (0)