@@ -976,6 +976,7 @@ class Namer { typer: Typer =>
976976 protected implicit val ctx : Context = localContext(cls).setMode(ictx.mode &~ Mode .InSuperCall )
977977
978978 private var localCtx : Context = _
979+
979980 /** info to be used temporarily while completing the class, to avoid cyclic references. */
980981 private var tempInfo : TempClassInfo = _
981982
@@ -1105,9 +1106,9 @@ class Namer { typer: Typer =>
11051106 * accessors, that's why the constructor needs to be completed before
11061107 * the parent types are elaborated.
11071108 */
1108- def completeConstructor (denot : SymDenotation ): Unit = {
1109+ def completeConstructor (denot : SymDenotation ): TempClassInfo = {
11091110 if (tempInfo != null ) // Constructor has been completed already
1110- return
1111+ return tempInfo
11111112
11121113 addAnnotations(denot.symbol)
11131114
@@ -1123,8 +1124,7 @@ class Namer { typer: Typer =>
11231124 else createSymbol(self)
11241125
11251126 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)
11281128
11291129 localCtx = ctx.inClassContext(selfInfo)
11301130
@@ -1137,7 +1137,9 @@ class Namer { typer: Typer =>
11371137 i """ Implementation restriction: case classes cannot have dependencies between parameters """ ,
11381138 cls.sourcePos)
11391139 case _ =>
1140+ tempInfo = denot.info.asInstanceOf [TempClassInfo ]
11401141 denot.info = savedInfo
1142+ tempInfo
11411143 }
11421144
11431145 /** The type signature of a ClassDef with given symbol */
@@ -1224,10 +1226,9 @@ class Namer { typer: Typer =>
12241226 deriver.enterDerived(impl.derived)
12251227 original.putAttachment(Deriver , deriver)
12261228 }
1227- denot.info = tempInfo.finalized(parentTypes)
12281229
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
12311232
12321233 Checking .checkWellFormed(cls)
12331234 if (isDerivedValueClass(cls)) cls.setFlag(Final )
0 commit comments