Skip to content

Commit 02d04c9

Browse files
committed
Remove deskolemize object from Context
This get rid of two fields when bootstrapping because inner objects are implemented as lazy vals which in Dotty requires a bitmap field.
1 parent 41add3b commit 02d04c9

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
7676
private def isLegalPrefix(pre: Type)(implicit ctx: Context) =
7777
pre.isStable || !ctx.phase.isTyper
7878

79-
/** Approximate a type `tp` with a type that does not contain skolem types. */
80-
object deskolemize extends ApproximatingTypeMap {
81-
def apply(tp: Type) = /*ctx.traceIndented(i"deskolemize($tp) at $variance", show = true)*/ {
82-
tp match {
83-
case tp: SkolemType => range(tp.bottomType, atVariance(1)(apply(tp.info)))
84-
case _ => mapOver(tp)
85-
}
86-
}
87-
}
88-
8979
/** Implementation of Types#simplified */
9080
final def simplify(tp: Type, theMap: SimplifyMap): Type = tp match {
9181
case tp: NamedType =>

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,18 @@ class Namer { typer: Typer =>
10611061

10621062
val rhsCtx = ctx.addMode(Mode.InferringReturnType)
10631063
def rhsType = typedAheadExpr(mdef.rhs, inherited orElse rhsProto)(rhsCtx).tpe
1064-
def cookedRhsType = ctx.deskolemize(dealiasIfUnit(widenRhs(rhsType)))
1064+
1065+
// Approximate a type `tp` with a type that does not contain skolem types.
1066+
val deskolemize = new ApproximatingTypeMap {
1067+
def apply(tp: Type) = /*ctx.traceIndented(i"deskolemize($tp) at $variance", show = true)*/ {
1068+
tp match {
1069+
case tp: SkolemType => range(tp.bottomType, atVariance(1)(apply(tp.info)))
1070+
case _ => mapOver(tp)
1071+
}
1072+
}
1073+
}
1074+
1075+
def cookedRhsType = deskolemize(dealiasIfUnit(widenRhs(rhsType)))
10651076
lazy val lhsType = fullyDefinedType(cookedRhsType, "right-hand side", mdef.pos)
10661077
//if (sym.name.toString == "y") println(i"rhs = $rhsType, cooked = $cookedRhsType")
10671078
if (inherited.exists)

0 commit comments

Comments
 (0)