@@ -1300,11 +1300,11 @@ object Types {
13001300 case tp =>
13011301 tp
13021302
1303- /** Widen all top-level singletons reachable by dealiasing
1304- * and going to the operands of & and |.
1303+ /** Widen all top-level singletons reachable
1304+ * by going to the operands of & and |.
13051305 * Overridden and cached in OrType.
13061306 */
1307- def widenSingletons (using Context ): Type = dealias match {
1307+ def widenSingletons (using Context ): Type = this match {
13081308 case tp : SingletonType =>
13091309 tp.widen
13101310 case tp : OrType =>
@@ -1846,11 +1846,11 @@ object Types {
18461846 case _ => this
18471847 }
18481848
1849- /** The set of distinct symbols referred to by this type, after all aliases are expanded */
1849+ /** The set of distinct symbols referred to by this type, after */
18501850 def coveringSet (using Context ): Set [Symbol ] =
18511851 (new CoveringSetAccumulator ).apply(Set .empty[Symbol ], this )
18521852
1853- /** The number of applications and refinements in this type, after all aliases are expanded */
1853+ /** The number of applications and refinements in this type, after */
18541854 def typeSize (using Context ): Int =
18551855 (new TypeSizeAccumulator ).apply(0 , this )
18561856
@@ -6137,11 +6137,12 @@ object Types {
61376137
61386138 class TypeSizeAccumulator (using Context ) extends TypeAccumulator [Int ] {
61396139 var seen = util.HashSet [Type ](initialCapacity = 8 )
6140- def apply (n : Int , tp : Type ): Int =
6141- if seen.contains(tp) then n
6140+ def apply (n : Int , tp1 : Type ): Int =
6141+ val tp0 = tp1.dealias
6142+ if seen.contains(tp0) then n
61426143 else {
6143- seen += tp
6144- tp match {
6144+ seen += tp0
6145+ tp0 match {
61456146 case tp : AppliedType =>
61466147 foldOver(n + 1 , tp)
61476148 case tp : RefinedType =>
@@ -6151,23 +6152,24 @@ object Types {
61516152 case tp : TypeParamRef =>
61526153 apply(n, TypeComparer .bounds(tp))
61536154 case _ =>
6154- foldOver(n, tp )
6155+ foldOver(n, tp0 )
61556156 }
61566157 }
61576158 }
61586159
61596160 class CoveringSetAccumulator (using Context ) extends TypeAccumulator [Set [Symbol ]] {
61606161 var seen = util.HashSet [Type ](initialCapacity = 8 )
6161- def apply (cs : Set [Symbol ], tp : Type ): Set [Symbol ] =
6162- if seen.contains(tp) then cs
6162+ def apply (cs : Set [Symbol ], tp1 : Type ): Set [Symbol ] =
6163+ val tp0 = tp1.dealias
6164+ if seen.contains(tp0) then cs
61636165 else {
6164- seen += tp
6165- tp match {
6166+ seen += tp0
6167+ tp0 match {
61666168 case tp if tp.isExactlyAny || tp.isExactlyNothing =>
61676169 cs
6168- case tp : AppliedType =>
6170+ case tp : AppliedType if ! tp.typeSymbol.isAliasType =>
61696171 foldOver(cs + tp.typeSymbol, tp)
6170- case tp : RefinedType =>
6172+ case tp : RefinedType if ! tp.typeSymbol.isAliasType =>
61716173 foldOver(cs + tp.typeSymbol, tp)
61726174 case tp : TypeRef if tp.info.isTypeAlias =>
61736175 apply(cs, tp.superType)
@@ -6179,7 +6181,7 @@ object Types {
61796181 case tp : TypeParamRef =>
61806182 apply(cs, TypeComparer .bounds(tp))
61816183 case other =>
6182- foldOver(cs, tp )
6184+ foldOver(cs, tp0 )
61836185 }
61846186 }
61856187 }
0 commit comments