Skip to content

Commit 033a521

Browse files
committed
Use recursive types also when unpickling from Scala 2.x
1 parent 90f63d4 commit 033a521

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -722,13 +722,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
722722
val parent = parents.reduceLeft(AndType(_, _))
723723
if (decls.isEmpty) parent
724724
else {
725-
def addRefinement(tp: Type, sym: Symbol) = {
726-
def subst(info: Type, rt: RefinedType) =
727-
if (clazz.isClass) info.substThis(clazz.asClass, RefinedThis(rt))
728-
else info // turns out some symbols read into `clazz` are not classes, not sure why this is the case.
729-
RefinedType(tp, sym.name, subst(sym.info, _))
730-
}
731-
(parent /: decls.toList)(addRefinement).asInstanceOf[RefinedType]
725+
def subst(info: Type, rt: RecType) =
726+
if (clazz.isClass) info.substThis(clazz.asClass, RecThis(rt))
727+
else info // turns out some symbols read into `clazz` are not classes, not sure why this is the case.
728+
def addRefinement(tp: Type, sym: Symbol) = RefinedType(tp, sym.name, sym.info)
729+
val refined = (parent /: decls.toList)(addRefinement)
730+
RecType.closeOver(rt => subst(refined, rt))
732731
}
733732
case CLASSINFOtpe =>
734733
val clazz = readSymbolRef()

0 commit comments

Comments
 (0)