diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-01-28 20:38:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-28 20:38:36 +0100 |
commit | 6e8933ccc40bbfe1a92c32c2d8314fd6facef12a (patch) | |
tree | a2a741e5e1c19caaab034a46c940cbbbd1a74eef /compiler/src/dotty | |
parent | d5201d3da5b6edb1abc61b51f125c0a3fd56000c (diff) | |
parent | fc2f9314be7281e24e4ce7434f97cc42cb2f01d4 (diff) | |
download | dotty-6e8933ccc40bbfe1a92c32c2d8314fd6facef12a.tar.gz dotty-6e8933ccc40bbfe1a92c32c2d8314fd6facef12a.tar.bz2 dotty-6e8933ccc40bbfe1a92c32c2d8314fd6facef12a.zip |
Merge pull request #1896 from dotty-staging/fix/bootstrap
Add sbt-based bootstrap
Diffstat (limited to 'compiler/src/dotty')
9 files changed, 44 insertions, 20 deletions
diff --git a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala index b5bfbb39f..59201687a 100644 --- a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala +++ b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala @@ -17,8 +17,6 @@ class JavaPlatform extends Platform { if (currentClassPath.isEmpty) currentClassPath = Some(new PathResolver().result) val cp = currentClassPath.get - //println(cp) - //println("------------------") cp } diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index 8df9a8c0e..184b3718a 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -255,14 +255,7 @@ class PathResolver(implicit ctx: Context) { def containers = Calculated.containers lazy val result: JavaClassPath = { - // Prioritize `dotty.jar` and `dotty-lib.jar` to shadow others - val (dottyJars, others) = - containers.partition(x => x.name.contains("dotty-lib.jar") || x.name.contains("dotty.jar")) - // Then any jars with `dotty` in the name - putting them before scala-library - val (dottyCp, remaining) = - others.partition(_.name.contains("dotty-")) - - val cp = new JavaClassPath((dottyJars ++ dottyCp ++ remaining).toIndexedSeq, context) + val cp = new JavaClassPath(containers.toIndexedSeq, context) if (settings.Ylogcp.value) { Console.println("Classpath built from " + settings.toConciseString(ctx.sstate)) diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 134b31519..0aeb28d36 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -319,7 +319,17 @@ class Definitions { def staticsMethodRef(name: PreName) = ScalaStaticsModule.requiredMethodRef(name) def staticsMethod(name: PreName) = ScalaStaticsModule.requiredMethod(name) - lazy val DottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef") + // Dotty deviation: we cannot use a lazy val here because lazy vals in dotty + // will return "null" when called recursively, see #1856. + def DottyPredefModuleRef = { + if (myDottyPredefModuleRef == null) { + myDottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef") + assert(myDottyPredefModuleRef != null) + } + myDottyPredefModuleRef + } + private[this] var myDottyPredefModuleRef: TermRef = _ + def DottyPredefModule(implicit ctx: Context) = DottyPredefModuleRef.symbol def Predef_eqAny(implicit ctx: Context) = DottyPredefModule.requiredMethod(nme.eqAny) diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index aaae78c57..a3475e14c 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -45,9 +45,13 @@ trait SymDenotations { this: Context => else { val initial = denot.initial val firstPhaseId = initial.validFor.firstPhaseId.max(ctx.typerPhase.id) - if ((initial ne denot) || ctx.phaseId != firstPhaseId) - ctx.withPhase(firstPhaseId).stillValidInOwner(initial) - else + if ((initial ne denot) || ctx.phaseId != firstPhaseId) { + ctx.withPhase(firstPhaseId).stillValidInOwner(initial) || + // Workaround #1895: A symbol might not be entered into an owner + // until the second phase where it exists + (denot.validFor.containsPhaseId(firstPhaseId + 1)) && + ctx.withPhase(firstPhaseId + 1).stillValidInOwner(initial) + } else stillValidInOwner(denot) } diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 101be167e..b75169792 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -567,7 +567,8 @@ object Scanners { nextChar() getOperatorRest() } else { - error(f"illegal character '\\u${ch: Int}%04x'") + // FIXME: Dotty deviation: f"" interpolator is not supported (#1814) + error("illegal character '\\u%04x'".format(ch: Int)) nextChar() } } diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala index fefa63f6f..c392880c5 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala @@ -175,7 +175,7 @@ private class ExtractDependenciesCollector(implicit val ctx: Context) extends tp override def traverse(tree: Tree)(implicit ctx: Context): Unit = { tree match { case Import(expr, selectors) => - def lookupImported(name: Name) = expr.tpe.member(name).symbol + def lookupImported(name: Name) = expr.tpe.select(name).typeSymbol def addImported(name: Name) = { // importing a name means importing both a term and a type (if they exist) addDependency(lookupImported(name.toTermName)) diff --git a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala index 2814baf1e..0e187fc2e 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala @@ -81,7 +81,11 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform val inSuper = if (ctx.mode.is(Mode.InSuperCall)) InSuperCall else EmptyFlags val meth = ctx.newSymbol( ctx.owner, nme.ANON_FUN, Synthetic | Method | inSuper, MethodType(Nil, Nil, argType)) - Closure(meth, _ => arg.changeOwner(ctx.owner, meth)) + Closure(meth, _ => + atGroupEnd { implicit ctx: Context => + arg.changeOwner(ctx.owner, meth) + } + ) } ref(defn.dummyApply).appliedToType(argType).appliedTo(argFun) case _ => diff --git a/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala index 925ec08b2..64474cecd 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala @@ -63,8 +63,13 @@ class ExtensionMethods extends MiniPhaseTransform with DenotTransformer with Ful // not generate them again. if (!(valueClass is Scala2x)) ctx.atPhase(thisTransformer) { implicit ctx => for (decl <- valueClass.classInfo.decls) { - if (isMethodWithExtension(decl)) - decls1.enter(createExtensionMethod(decl, moduleClassSym.symbol)) + if (isMethodWithExtension(decl)) { + val meth = createExtensionMethod(decl, moduleClassSym.symbol) + decls1.enter(meth) + // Workaround #1895: force denotation of `meth` to be + // at phase where `meth` is entered into the decls of a class + meth.denot(ctx.withPhase(thisTransformer.next)) + } } } diff --git a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala index a5657890e..f7efb2ac2 100644 --- a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala +++ b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala @@ -30,7 +30,16 @@ object ImportInfo { class ImportInfo(symf: => Symbol, val selectors: List[untpd.Tree], symNameOpt: Option[TermName], val isRootImport: Boolean = false)(implicit ctx: Context) { - lazy val sym = symf + // Dotty deviation: we cannot use a lazy val here for the same reason + // that we cannot use one for `DottyPredefModuleRef`. + def sym = { + if (mySym == null) { + mySym = symf + assert(mySym != null) + } + mySym + } + private[this] var mySym: Symbol = _ /** The (TermRef) type of the qualifier of the import clause */ def site(implicit ctx: Context): Type = { |