diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 40b8412308a4..d75335f09931 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -431,11 +431,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma var found = desugared.get(i.tpe) if (found == null) { i.tpe match { - case TermRef(prefix: TermRef, name) => + case TermRef(prefix: TermRef, _) => found = tpd.ref(prefix).select(i.symbol) - case TermRef(prefix: ThisType, name) => + case TermRef(prefix: ThisType, _) => found = tpd.This(prefix.cls).select(i.symbol) - case TermRef(NoPrefix, name) => + case TermRef(NoPrefix, _) => if (i.symbol is Flags.Method) found = This(i.symbol.topLevelClass).select(i.symbol) // workaround #342 todo: remove after fixed case _ => } diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index 10ccc59a3e5f..ebf16bb9eb14 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -105,7 +105,7 @@ class Run(comp: Compiler, ictx: Context) { compileUnits()(ctx) } - protected def compileUnits()(implicit ctx: Context) = Stats.monitorHeartBeat { + protected def compileUnits()(implicit ctx: Context) = Stats.maybeMonitored { ctx.checkSingleThreaded() // If testing pickler, make sure to stop after pickling phase: @@ -118,20 +118,21 @@ class Run(comp: Compiler, ictx: Context) { ctx.usePhases(phases) var lastPrintedTree: PrintedTree = NoPrintedTree for (phase <- ctx.allPhases) - if (phase.isRunnable) { - val start = System.currentTimeMillis - units = phase.runOn(units) - if (ctx.settings.Xprint.value.containsPhase(phase)) { - for (unit <- units) { - lastPrintedTree = - printTree(lastPrintedTree)(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit)) + if (phase.isRunnable) + Stats.trackTime(s"$phase ms ") { + val start = System.currentTimeMillis + units = phase.runOn(units) + if (ctx.settings.Xprint.value.containsPhase(phase)) { + for (unit <- units) { + lastPrintedTree = + printTree(lastPrintedTree)(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit)) + } } + ctx.informTime(s"$phase ", start) + Stats.record(s"total trees at end of $phase", ast.Trees.ntrees) + for (unit <- units) + Stats.record(s"retained typed trees at end of $phase", unit.tpdTree.treeSize) } - ctx.informTime(s"$phase ", start) - Stats.record(s"total trees at end of $phase", ast.Trees.ntrees) - for (unit <- units) - Stats.record(s"retained typed trees at end of $phase", unit.tpdTree.treeSize) - } if (!ctx.reporter.hasErrors) Rewrites.writeBack() } diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 4b3ea0df7e75..47ad30e0ea5b 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -5,7 +5,7 @@ package ast import core._ import util.Positions._, Types._, Contexts._, Constants._, Names._, NameOps._, Flags._ import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ -import Decorators._ +import Decorators._, transform.SymUtils._ import NameKinds.{UniqueName, EvidenceParamName, DefaultGetterName} import language.higherKinds import typer.FrontEnd @@ -70,7 +70,7 @@ object desugar { def apply(tp: Type) = tp match { case tp: NamedType if tp.symbol.exists && (tp.symbol.owner eq originalOwner) => val defctx = ctx.outersIterator.dropWhile(_.scope eq ctx.scope).next() - var local = defctx.denotNamed(tp.name).suchThat(_ is ParamOrAccessor).symbol + var local = defctx.denotNamed(tp.name).suchThat(_.isParamOrAccessor).symbol if (local.exists) (defctx.owner.thisType select local).dealias else { def msg = @@ -238,23 +238,6 @@ object desugar { Nil } - /** Fill in empty type bounds with Nothing/Any. Expand private local type parameters as follows: - * - * class C[v T] - * ==> - * class C { type v C$T; type v T = C$T } - */ - def typeDef(tdef: TypeDef)(implicit ctx: Context): Tree = { - if (tdef.mods is PrivateLocalParam) { - val tparam = cpy.TypeDef(tdef)(name = tdef.name.expandedName(ctx.owner)) - .withMods(tdef.mods &~ PrivateLocal) - val alias = cpy.TypeDef(tdef)(rhs = refOfDef(tparam)) - .withMods(tdef.mods & VarianceFlags | PrivateLocalParamAccessor | Synthetic) - Thicket(tparam, alias) - } - else tdef - } - @sharable private val synthetic = Modifiers(Synthetic) private def toDefParam(tparam: TypeDef): TypeDef = @@ -696,7 +679,7 @@ object desugar { def defTree(tree: Tree)(implicit ctx: Context): Tree = tree match { case tree: ValDef => valDef(tree) - case tree: TypeDef => if (tree.isClassDef) classDef(tree) else typeDef(tree) + case tree: TypeDef => if (tree.isClassDef) classDef(tree) else tree case tree: DefDef => defDef(tree) case tree: ModuleDef => moduleDef(tree) case tree: PatDef => patDef(tree) @@ -1074,7 +1057,7 @@ object desugar { } else if (arity == 1) ts.head else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts) else if (arity == 0) unitLiteral - else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts) + else Apply(ref(tupleTypeRef.classSymbol.companionModule.termRef), ts) case WhileDo(cond, body) => // {