@@ -1304,11 +1304,11 @@ object Types {
13041304 case tp =>
13051305 tp
13061306
1307- /** Widen all top-level singletons reachable by dealiasing
1308- * and going to the operands of & and |.
1307+ /** Widen all top-level singletons reachable
1308+ * by going to the operands of & and |.
13091309 * Overridden and cached in OrType.
13101310 */
1311- def widenSingletons (using Context ): Type = dealias match {
1311+ def widenSingletons (using Context ): Type = this match {
13121312 case tp : SingletonType =>
13131313 tp.widen
13141314 case tp : OrType =>
@@ -1856,11 +1856,11 @@ object Types {
18561856 case _ => this
18571857 }
18581858
1859- /** The set of distinct symbols referred to by this type, after all aliases are expanded */
1859+ /** The set of distinct symbols referred to by this type */
18601860 def coveringSet (using Context ): Set [Symbol ] =
18611861 (new CoveringSetAccumulator ).apply(Set .empty[Symbol ], this )
18621862
1863- /** The number of applications and refinements in this type, after all aliases are expanded */
1863+ /** The number of applications and refinements in this type */
18641864 def typeSize (using Context ): Int =
18651865 (new TypeSizeAccumulator ).apply(0 , this )
18661866
@@ -6178,11 +6178,12 @@ object Types {
61786178
61796179 class TypeSizeAccumulator (using Context ) extends TypeAccumulator [Int ] {
61806180 var seen = util.HashSet [Type ](initialCapacity = 8 )
6181- def apply (n : Int , tp : Type ): Int =
6182- if seen.contains(tp) then n
6181+ def apply (n : Int , tp1 : Type ): Int =
6182+ val tp0 = tp1.dealias
6183+ if seen.contains(tp0) then n
61836184 else {
6184- seen += tp
6185- tp match {
6185+ seen += tp0
6186+ tp0 match {
61866187 case tp : AppliedType =>
61876188 foldOver(n + 1 , tp)
61886189 case tp : RefinedType =>
@@ -6192,23 +6193,24 @@ object Types {
61926193 case tp : TypeParamRef =>
61936194 apply(n, TypeComparer .bounds(tp))
61946195 case _ =>
6195- foldOver(n, tp )
6196+ foldOver(n, tp0 )
61966197 }
61976198 }
61986199 }
61996200
62006201 class CoveringSetAccumulator (using Context ) extends TypeAccumulator [Set [Symbol ]] {
62016202 var seen = util.HashSet [Type ](initialCapacity = 8 )
6202- def apply (cs : Set [Symbol ], tp : Type ): Set [Symbol ] =
6203- if seen.contains(tp) then cs
6203+ def apply (cs : Set [Symbol ], tp1 : Type ): Set [Symbol ] =
6204+ val tp0 = tp1.dealias
6205+ if seen.contains(tp0) then cs
62046206 else {
6205- seen += tp
6206- tp match {
6207+ seen += tp0
6208+ tp0 match {
62076209 case tp if tp.isExactlyAny || tp.isExactlyNothing =>
62086210 cs
6209- case tp : AppliedType =>
6211+ case tp : AppliedType if ! tp.typeSymbol.isAliasType =>
62106212 foldOver(cs + tp.typeSymbol, tp)
6211- case tp : RefinedType =>
6213+ case tp : RefinedType if ! tp.typeSymbol.isAliasType =>
62126214 foldOver(cs + tp.typeSymbol, tp)
62136215 case tp : TypeRef if tp.info.isTypeAlias =>
62146216 apply(cs, tp.superType)
@@ -6220,7 +6222,7 @@ object Types {
62206222 case tp : TypeParamRef =>
62216223 apply(cs, TypeComparer .bounds(tp))
62226224 case other =>
6223- foldOver(cs, tp )
6225+ foldOver(cs, tp0 )
62246226 }
62256227 }
62266228 }
0 commit comments