@@ -91,7 +91,7 @@ object Scala2Unpickler {
9191 cls.enter(constr, scope)
9292 }
9393
94- def setClassInfo (denot : ClassDenotation , info : Type , selfInfo : Type = NoType )(implicit ctx : Context ): Unit = {
94+ def setClassInfo (denot : ClassDenotation , info : Type , fromScala2 : Boolean , selfInfo : Type = NoType )(implicit ctx : Context ): Unit = {
9595 val cls = denot.classSymbol
9696 val (tparams, TempClassInfoType (parents, decls, clazz)) = info match {
9797 case TempPolyType (tps, cinfo) => (tps, cinfo)
@@ -106,9 +106,11 @@ object Scala2Unpickler {
106106 else selfInfo
107107 val tempInfo = new TempClassInfo (denot.owner.thisType, cls, decls, ost)
108108 denot.info = tempInfo // first rough info to avoid CyclicReferences
109+ val parents1 = if (parents.isEmpty) defn.ObjectType :: Nil else parents.map(_.dealias)
110+ // Add extra parents to the tuple classes from the standard library
109111 val normalizedParents =
110- defn.adjustForTuple(cls, tparams,
111- if (parents.isEmpty) defn. ObjectType :: Nil else parents.map(_.dealias))
112+ if (fromScala2) defn.adjustForTuple(cls, tparams, parents1)
113+ else parents1 // We are setting the info of a Java class, so it cannot be one of the tuple classes
112114 for (tparam <- tparams) {
113115 val tsym = decls.lookup(tparam.name)
114116 if (tsym.exists) tsym.setFlag(TypeParam )
@@ -553,7 +555,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
553555 denot match {
554556 case denot : ClassDenotation =>
555557 val selfInfo = if (atEnd) NoType else readTypeRef()
556- setClassInfo(denot, tp, selfInfo)
558+ setClassInfo(denot, tp, fromScala2 = true , selfInfo)
557559 case denot =>
558560 val tp1 = translateTempPoly(tp)
559561 denot.info =
0 commit comments