Skip to content

Commit 62566c5

Browse files
committed
Compile stdlib-bootstrapped with -Yscala2-stdlib
1 parent 2b7ad53 commit 62566c5

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ private sealed trait YSettings:
367367
val YfromTastyIgnoreList: Setting[List[String]] = MultiStringSetting("-Yfrom-tasty-ignore-list", "file", "List of `tasty` files in jar files that will not be loaded when using -from-tasty")
368368
val YnoExperimental: Setting[Boolean] = BooleanSetting("-Yno-experimental", "Disable experimental language features")
369369
val YlegacyLazyVals: Setting[Boolean] = BooleanSetting("-Ylegacy-lazy-vals", "Use legacy (pre 3.3.0) implementation of lazy vals")
370+
val Yscala2Stdlib: Setting[Boolean] = BooleanSetting("-Yscala2-stdlib", "Used when compiling the Scala 2 standard library")
370371

371372
val YprofileEnabled: Setting[Boolean] = BooleanSetting("-Yprofile-enabled", "Enable profiling.")
372373
val YprofileDestination: Setting[String] = StringSetting("-Yprofile-destination", "file", "Where to send profiling output - specify a file, default is to the console.", "")

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

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

155155
checkVersion(using ictx)
156+
checkScala2Stdlib(using ictx)
156157

157158
private val loadingMirror = defn(using ictx) // was: mirrorThatLoaded(classRoot)
158159

@@ -239,6 +240,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
239240
" in " + source)
240241
}
241242

243+
private def checkScala2Stdlib(using Context): Unit =
244+
assert(!ctx.settings.Yscala2Stdlib.value, "No Scala 2 libraries should be unpickled under -Yscala2-stdlib")
245+
242246
/** The `decls` scope associated with given symbol */
243247
protected def symScope(sym: Symbol): Scope = symScopes.getOrElseUpdate(sym, newScope(0))
244248

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ object Build {
937937
Seq("-sourcepath", ((Compile/sourceManaged).value / "scala-library-src").toString)
938938
},
939939
Compile / doc / scalacOptions += "-Ydocument-synthetic-types",
940+
scalacOptions += "-Yscala2-stdlib",
940941
scalacOptions -= "-Xfatal-warnings",
941942
ivyConfigurations += SourceDeps.hide,
942943
transitiveClassifiers := Seq("sources"),

0 commit comments

Comments
 (0)