Skip to content

Commit 3a87192

Browse files
committed
Cross-compile the compiler with the 2.13 stdlib
We still need to support compiling it against the 2.12 stdlib until we release a new reference compiler because the current reference compiler cannot use the 2.13 stdlib. This is mostly not a problem, except that this forces us to keep two versions of WeakHashSet, the same source file cannot be used for both the 2.12 and 2.13 stdlib since `-=` and `+=` are final in 2.13.
1 parent d8e7882 commit 3a87192

File tree

19 files changed

+441
-59
lines changed

19 files changed

+441
-59
lines changed

compiler/src-bootstrapped/dotty/tools/dotc/util/WeakHashSet.scala

Lines changed: 404 additions & 0 deletions
Large diffs are not rendered by default.

compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: BackendInterface]](val bTypes: B
131131
lazy val srFloatRef : ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.FloatRef])
132132
lazy val srDoubleRef : ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.DoubleRef])
133133

134-
// scala.FunctionX and scala.runtim.AbstractFunctionX
135-
lazy val FunctionReference : Vector[ClassBType] = (0 to MaxFunctionArity).map(i => classBTypeFromSymbol(FunctionClass(i)))(collection.breakOut)
136-
lazy val AbstractFunctionReference : Vector[ClassBType] = (0 to MaxFunctionArity).map(i => classBTypeFromSymbol(AbstractFunctionClass(i)))(collection.breakOut)
137-
lazy val AbstractFunctionArityMap : Map[ClassBType, Int] = AbstractFunctionReference.zipWithIndex.toMap
138-
139-
lazy val PartialFunctionReference : ClassBType = classBTypeFromSymbol(PartialFunctionClass)
140-
lazy val AbstractPartialFunctionReference : ClassBType = classBTypeFromSymbol(AbstractPartialFunctionClass)
141-
142134
lazy val BoxesRunTime: ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.BoxesRunTime])
143135

144136
/**
@@ -263,13 +255,6 @@ final class CoreBTypesProxy[BTFS <: BTypesFromSymbols[_ <: BackendInterface]](va
263255
def srFloatRef : ClassBType = _coreBTypes.srFloatRef
264256
def srDoubleRef : ClassBType = _coreBTypes.srDoubleRef
265257

266-
def FunctionReference : Vector[ClassBType] = _coreBTypes.FunctionReference
267-
def AbstractFunctionReference : Vector[ClassBType] = _coreBTypes.AbstractFunctionReference
268-
def AbstractFunctionArityMap : Map[ClassBType, Int] = _coreBTypes.AbstractFunctionArityMap
269-
270-
def PartialFunctionReference : ClassBType = _coreBTypes.PartialFunctionReference
271-
def AbstractPartialFunctionReference : ClassBType = _coreBTypes.AbstractPartialFunctionReference
272-
273258
def BoxesRunTime: ClassBType = _coreBTypes.BoxesRunTime
274259

275260
def asmBoxTo : Map[BType, MethodNameAndType] = _coreBTypes.asmBoxTo

compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath {
8787
* creates an entry containing both of them. If there would be more than one class or source
8888
* entries for the same class it always would use the first entry of each type found on a classpath.
8989
*/
90-
private def mergeClassesAndSources(entries: Seq[ClassRepresentation]*): Seq[ClassRepresentation] = {
90+
private def mergeClassesAndSources(entries: scala.collection.Seq[ClassRepresentation]*): Seq[ClassRepresentation] = {
9191
// based on the implementation from MergedClassPath
9292
var count = 0
9393
val indices = collection.mutable.HashMap[String, Int]()

compiler/src/dotty/tools/dotc/classpath/ClassPath.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package dotty.tools.dotc.classpath
66
import dotty.tools.io.AbstractFile
77
import dotty.tools.io.ClassRepresentation
88

9-
case class ClassPathEntries(packages: Seq[PackageEntry], classesAndSources: Seq[ClassRepresentation]) {
10-
def toTuple: (Seq[PackageEntry], Seq[ClassRepresentation]) = (packages, classesAndSources)
9+
case class ClassPathEntries(packages: scala.collection.Seq[PackageEntry], classesAndSources: scala.collection.Seq[ClassRepresentation]) {
10+
def toTuple: (scala.collection.Seq[PackageEntry], scala.collection.Seq[ClassRepresentation]) = (packages, classesAndSources)
1111
}
1212

1313
trait ClassFileEntry extends ClassRepresentation {

compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ trait DirectoryLookup[FileEntryType <: ClassRepresentation] extends ClassPath {
6060
case None => emptyFiles
6161
case Some(directory) => listChildren(directory, Some(isMatchingFile))
6262
}
63-
files.map(f => createFileEntry(toAbstractFile(f)))
63+
files.iterator.map(f => createFileEntry(toAbstractFile(f))).toSeq
6464
}
6565

6666
private[dotty] def list(inPackage: String): ClassPathEntries = {

compiler/src/dotty/tools/dotc/classpath/ZipAndJarFileLookupFactory.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ object ZipAndJarClassPathFactory extends ZipAndJarFileLookupFactory {
9494
val packages = collection.mutable.HashMap[String, PackageFileInfo]()
9595

9696
def getSubpackages(dir: AbstractFile): List[AbstractFile] =
97-
(for (file <- dir if file.isPackage) yield file)(collection.breakOut)
97+
(for (file <- dir if file.isPackage) yield file).toList
9898

9999
@tailrec
100100
def traverse(packagePrefix: String,
@@ -129,7 +129,7 @@ object ZipAndJarClassPathFactory extends ZipAndJarFileLookupFactory {
129129
override private[dotty] def classes(inPackage: String): Seq[ClassFileEntry] = cachedPackages.get(inPackage) match {
130130
case None => Seq.empty
131131
case Some(PackageFileInfo(pkg, _)) =>
132-
(for (file <- pkg if file.isClass) yield ClassFileEntryImpl(file))(collection.breakOut)
132+
(for (file <- pkg if file.isClass) yield ClassFileEntryImpl(file)).toSeq
133133
}
134134

135135
override private[dotty] def hasPackage(pkg: String) = cachedPackages.contains(pkg)

compiler/src/dotty/tools/dotc/classpath/ZipArchiveFileLookup.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package dotty.tools.dotc.classpath
55

66
import java.io.File
77
import java.net.URL
8-
import scala.collection.Seq
8+
99
import dotty.tools.io.{ AbstractFile, FileZipArchive }
1010
import FileUtils.AbstractFileOps
1111
import dotty.tools.io.{ClassPath, ClassRepresentation}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object Settings {
3737

3838
def update(idx: Int, x: Any): SettingsState =
3939
if (_wasRead)
40-
new SettingsState(values).update(idx, x)
40+
new SettingsState(values.toSeq).update(idx, x)
4141
else {
4242
values(idx) = x
4343
this
@@ -194,7 +194,7 @@ object Settings {
194194
class SettingGroup {
195195

196196
private[this] val _allSettings = new ArrayBuffer[Setting[_]]
197-
def allSettings: Seq[Setting[_]] = _allSettings
197+
def allSettings: Seq[Setting[_]] = _allSettings.toSeq
198198

199199
def defaultState: SettingsState = new SettingsState(allSettings map (_.default))
200200

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ object Contexts {
708708

709709
/** A map that associates label and size of all uniques sets */
710710
def uniquesSizes: Map[String, (Int, Int, Int)] =
711-
uniqueSets.mapValues(s => (s.size, s.accesses, s.misses))
711+
uniqueSets.transform((_, s) => (s.size, s.accesses, s.misses))
712712

713713
/** Number of findMember calls on stack */
714714
private[core] var findMemberCount: Int = 0

0 commit comments

Comments
 (0)