Skip to content

Commit f6853cc

Browse files
committed
Some refactorings involvng TempInfos
1 parent c2478a3 commit f6853cc

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4336,9 +4336,9 @@ object Types {
43364336
final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: TypeOrSymbol)
43374337
extends CachedClassInfo(prefix, cls, Nil, decls, selfInfo) {
43384338

4339-
/** Install classinfo with known parents in `denot` s */
4340-
def finalize(denot: SymDenotation, parents: List[Type])(implicit ctx: Context): Unit =
4341-
denot.info = ClassInfo(prefix, cls, parents, decls, selfInfo)
4339+
/** Convert to classinfo with known parents */
4340+
def finalized(parents: List[Type])(implicit ctx: Context): ClassInfo =
4341+
ClassInfo(prefix, cls, parents, decls, selfInfo)
43424342

43434343
override def derivedClassInfo(prefix: Type)(implicit ctx: Context): ClassInfo =
43444344
if (prefix eq this.prefix) this

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ object Scala2Unpickler {
135135
else
136136
registerCompanionPair(scalacCompanion, denot.classSymbol)
137137

138-
tempInfo.finalize(denot, normalizedParents) // install final info, except possibly for typeparams ordering
138+
denot.info = tempInfo.finalized(normalizedParents)
139139
denot.ensureTypeParamsInCorrectOrder()
140140
}
141141
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,7 @@ class Namer { typer: Typer =>
12081208
}
12091209
}
12101210

1211-
if (tempInfo == null) // Constructor has not been completed yet
1212-
completeConstructor(denot)
1213-
1211+
completeConstructor(denot)
12141212
denot.info = tempInfo
12151213

12161214
val parentTypes = defn.adjustForTuple(cls, cls.typeParams,
@@ -1226,8 +1224,8 @@ class Namer { typer: Typer =>
12261224
deriver.enterDerived(impl.derived)
12271225
original.putAttachment(Deriver, deriver)
12281226
}
1227+
denot.info = tempInfo.finalized(parentTypes)
12291228

1230-
tempInfo.finalize(denot, parentTypes)
12311229
// The temporary info can now be garbage-collected
12321230
tempInfo = null
12331231

0 commit comments

Comments
 (0)