@@ -48,7 +48,7 @@ object GenericSignatures {
4848 // a signature should always start with a class
4949 def ensureClassAsFirstParent (tps : List [Type ]) = tps match {
5050 case Nil => defn.ObjectType :: Nil
51- case head :: tail if isInterfaceOrTrait(head.typeSymbol) => defn.ObjectType :: tps
51+ case head :: tail if isInterfaceOrTrait(head.widen. typeSymbol) => defn.ObjectType :: tps
5252 case _ => tps
5353 }
5454
@@ -66,7 +66,7 @@ object GenericSignatures {
6666 def boxedSig (tp : Type ): Unit = jsig(tp.widenDealias, primitiveOK = false )
6767
6868 def boundsSig (bounds : List [Type ]): Unit = {
69- val (isTrait, isClass) = bounds partition (_.typeSymbol.is(Trait ))
69+ val (isTrait, isClass) = bounds partition (_.widen. typeSymbol.is(Trait ))
7070 isClass match {
7171 case Nil => builder.append(':' ) // + boxedSig(ObjectTpe)
7272 case x :: _ => builder.append(':' ); boxedSig(x)
@@ -97,7 +97,7 @@ object GenericSignatures {
9797
9898 def methodResultSig (restpe : Type ): Unit = {
9999 val finalType = restpe.finalResultType
100- val sym = finalType.typeSymbol
100+ val sym = finalType.widen. typeSymbol
101101 if (sym == defn.UnitClass || sym == defn.BoxedUnitModule || sym0.isConstructor)
102102 builder.append(ClassfileConstants .VOID_TAG )
103103 else
@@ -133,7 +133,7 @@ object GenericSignatures {
133133 case PolyType (_, res) =>
134134 builder.append('*' ) // scala/bug#7932
135135 case _ : HKTypeLambda =>
136- fullNameInSig(tp.typeSymbol)
136+ fullNameInSig(tp.widen. typeSymbol)
137137 builder.append(';' )
138138 case _ =>
139139 boxedSig(tp)
@@ -148,7 +148,7 @@ object GenericSignatures {
148148 builder.delete(builder.length() - 1 , builder.length())// delete ';'
149149 // If the prefix is a module, drop the '$'. Classes (or modules) nested in modules
150150 // are separated by a single '$' in the filename: `object o { object i }` is o$i$.
151- if (preRebound.typeSymbol.is(ModuleClass ))
151+ if (preRebound.widen. typeSymbol.is(ModuleClass ))
152152 builder.delete(builder.length() - 1 , builder.length())
153153
154154 // Ensure every '.' in the generated signature immediately follows
@@ -324,10 +324,10 @@ object GenericSignatures {
324324 private def intersectionDominator (parents : List [Type ])(using Context ): Type =
325325 if (parents.isEmpty) defn.ObjectType
326326 else {
327- val psyms = parents map (_.typeSymbol)
327+ val psyms = parents map (_.widen. typeSymbol)
328328 if (psyms contains defn.ArrayClass )
329329 // treat arrays specially
330- defn.ArrayType .appliedTo(intersectionDominator(parents.filter(_.typeSymbol == defn.ArrayClass ).map(t => t.argInfos.head)))
330+ defn.ArrayType .appliedTo(intersectionDominator(parents.filter(_.widen. typeSymbol == defn.ArrayClass ).map(t => t.argInfos.head)))
331331 else {
332332 // implement new spec for erasure of refined types.
333333 def isUnshadowed (psym : Symbol ) =
@@ -350,12 +350,12 @@ object GenericSignatures {
350350 var leaves = collection.mutable.ListBuffer .empty[Type ] += parents.head
351351 while (rest.nonEmpty) {
352352 val candidate = rest.head
353- val candidateSym = candidate.typeSymbol
354- // val required = requiredDirect(candidateSym) || !leaves.exists(t => t.typeSymbol isSubClass candidateSym)
355- val required = ! leaves.exists(t => t.typeSymbol.isSubClass(candidateSym))
353+ val candidateSym = candidate.widen. typeSymbol
354+ // val required = requiredDirect(candidateSym) || !leaves.exists(t => t.widen. typeSymbol isSubClass candidateSym)
355+ val required = ! leaves.exists(t => t.widen. typeSymbol.isSubClass(candidateSym))
356356 if (required) {
357357 leaves = leaves filter { t =>
358- val ts = t.typeSymbol
358+ val ts = t.widen. typeSymbol
359359 ! (ts.is(Trait ) || ts.is(PureInterface )) || ! candidateSym.isSubClass(ts)
360360 // requiredDirect(ts) || !ts.isTraitOrInterface || !candidateSym.isSubClass(ts)
361361 }
@@ -400,14 +400,14 @@ object GenericSignatures {
400400 private object RefOrAppliedType {
401401 def unapply (tp : Type )(using Context ): Option [(Symbol , Type , List [Type ])] = tp match {
402402 case TypeParamRef (_, _) =>
403- Some ((tp.typeSymbol, tp, Nil ))
403+ Some ((tp.widen. typeSymbol, tp, Nil ))
404404 case TermParamRef (_, _) =>
405405 Some ((tp.termSymbol, tp, Nil ))
406- case TypeRef (pre, _) if ! tp.typeSymbol.isAliasType =>
407- val sym = tp.typeSymbol
406+ case TypeRef (pre, _) if ! tp.widen. typeSymbol.isAliasType =>
407+ val sym = tp.widen. typeSymbol
408408 Some ((sym, pre, Nil ))
409409 case AppliedType (pre, args) =>
410- Some ((pre.typeSymbol, pre, args))
410+ Some ((pre.widen. typeSymbol, pre, args))
411411 case _ =>
412412 None
413413 }
@@ -423,11 +423,11 @@ object GenericSignatures {
423423 if (! x)
424424 tp match {
425425 case RefinedType (parent, refinedName, refinedInfo) =>
426- val sym = parent.typeSymbol
426+ val sym = parent.widen. typeSymbol
427427 if (sym == defn.ArrayClass ) foldOver(x, refinedInfo)
428428 else true
429429 case tref @ TypeRef (pre, name) =>
430- val sym = tref.typeSymbol
430+ val sym = tref.widen. typeSymbol
431431 if (sym.is(TypeParam ) || sym.typeParams.nonEmpty) true
432432 else if (sym.isClass) foldOver(x, rebindInnerClass(pre, sym)) // #2585
433433 else foldOver(x, pre)
0 commit comments