diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index bdc0be6e6ca3..7b687afeb9f2 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -263,6 +263,9 @@ object Contexts { final def withPhaseNoEarlier(phase: Phase) = if (phase.exists && ctx.phase.id < phase.id) withPhase(phase) else ctx + // `creationTrace`-related code. To enable, uncomment the code below and the + // call to `setCreationTrace()` in this file. + /* /** If -Ydebug is on, the top of the stack trace where this context * was created, otherwise `null`. */ @@ -281,6 +284,7 @@ object Contexts { } println("=== end context creation trace ===") } + */ /** The current reporter */ def reporter: Reporter = typerState.reporter @@ -414,7 +418,8 @@ object Contexts { this.implicitsCache = null this.phasedCtx = this this.phasedCtxs = null - setCreationTrace() + // See comment related to `creationTrace` in this file + // setCreationTrace() this } diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index 8fbda8daf7b5..a426fa5c1d53 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -76,16 +76,6 @@ trait TypeOps { this: Context => // TODO: Make standalone object. private def isLegalPrefix(pre: Type)(implicit ctx: Context) = pre.isStable || !ctx.phase.isTyper - /** Approximate a type `tp` with a type that does not contain skolem types. */ - object deskolemize extends ApproximatingTypeMap { - def apply(tp: Type) = /*ctx.traceIndented(i"deskolemize($tp) at $variance", show = true)*/ { - tp match { - case tp: SkolemType => range(tp.bottomType, atVariance(1)(apply(tp.info))) - case _ => mapOver(tp) - } - } - } - /** Implementation of Types#simplified */ final def simplify(tp: Type, theMap: SimplifyMap): Type = tp match { case tp: NamedType => diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 6976de7225ba..7b2801670ae6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1061,7 +1061,18 @@ class Namer { typer: Typer => val rhsCtx = ctx.addMode(Mode.InferringReturnType) def rhsType = typedAheadExpr(mdef.rhs, inherited orElse rhsProto)(rhsCtx).tpe - def cookedRhsType = ctx.deskolemize(dealiasIfUnit(widenRhs(rhsType))) + + // Approximate a type `tp` with a type that does not contain skolem types. + val deskolemize = new ApproximatingTypeMap { + def apply(tp: Type) = /*ctx.traceIndented(i"deskolemize($tp) at $variance", show = true)*/ { + tp match { + case tp: SkolemType => range(tp.bottomType, atVariance(1)(apply(tp.info))) + case _ => mapOver(tp) + } + } + } + + def cookedRhsType = deskolemize(dealiasIfUnit(widenRhs(rhsType))) lazy val lhsType = fullyDefinedType(cookedRhsType, "right-hand side", mdef.pos) //if (sym.name.toString == "y") println(i"rhs = $rhsType, cooked = $cookedRhsType") if (inherited.exists)