Skip to content

Commit 7b709ea

Browse files
committed
Some refactorings involvng TempInfos
1 parent 6466611 commit 7b709ea

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
@@ -4343,9 +4343,9 @@ object Types {
43434343
final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: TypeOrSymbol)
43444344
extends CachedClassInfo(prefix, cls, Nil, decls, selfInfo) {
43454345

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

43504350
override def derivedClassInfo(prefix: Type)(implicit ctx: Context): ClassInfo =
43514351
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)