@@ -976,6 +976,7 @@ class Namer { typer: Typer =>
976
976
protected implicit val ctx : Context = localContext(cls).setMode(ictx.mode &~ Mode .InSuperCall )
977
977
978
978
private var localCtx : Context = _
979
+
979
980
/** info to be used temporarily while completing the class, to avoid cyclic references. */
980
981
private var tempInfo : TempClassInfo = _
981
982
@@ -1105,9 +1106,9 @@ class Namer { typer: Typer =>
1105
1106
* accessors, that's why the constructor needs to be completed before
1106
1107
* the parent types are elaborated.
1107
1108
*/
1108
- def completeConstructor (denot : SymDenotation ): Unit = {
1109
+ def completeConstructor (denot : SymDenotation ): TempClassInfo = {
1109
1110
if (tempInfo != null ) // Constructor has been completed already
1110
- return
1111
+ return tempInfo
1111
1112
1112
1113
addAnnotations(denot.symbol)
1113
1114
@@ -1123,8 +1124,7 @@ class Namer { typer: Typer =>
1123
1124
else createSymbol(self)
1124
1125
1125
1126
val savedInfo = denot.infoOrCompleter
1126
- tempInfo = new TempClassInfo (cls.owner.thisType, cls, decls, selfInfo)
1127
- denot.info = tempInfo
1127
+ denot.info = new TempClassInfo (cls.owner.thisType, cls, decls, selfInfo)
1128
1128
1129
1129
localCtx = ctx.inClassContext(selfInfo)
1130
1130
@@ -1137,7 +1137,9 @@ class Namer { typer: Typer =>
1137
1137
i """ Implementation restriction: case classes cannot have dependencies between parameters """ ,
1138
1138
cls.sourcePos)
1139
1139
case _ =>
1140
+ tempInfo = denot.info.asInstanceOf [TempClassInfo ]
1140
1141
denot.info = savedInfo
1142
+ tempInfo
1141
1143
}
1142
1144
1143
1145
/** The type signature of a ClassDef with given symbol */
@@ -1224,10 +1226,9 @@ class Namer { typer: Typer =>
1224
1226
deriver.enterDerived(impl.derived)
1225
1227
original.putAttachment(Deriver , deriver)
1226
1228
}
1227
- denot.info = tempInfo.finalized(parentTypes)
1228
1229
1229
- // The temporary info can now be garbage-collected
1230
- tempInfo = null
1230
+ denot. info = tempInfo.finalized(parentTypes)
1231
+ tempInfo = null // The temporary info can now be garbage-collected
1231
1232
1232
1233
Checking .checkWellFormed(cls)
1233
1234
if (isDerivedValueClass(cls)) cls.setFlag(Final )
0 commit comments