@@ -1304,11 +1304,11 @@ object Types {
1304
1304
case tp =>
1305
1305
tp
1306
1306
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 |.
1309
1309
* Overridden and cached in OrType.
1310
1310
*/
1311
- def widenSingletons (using Context ): Type = dealias match {
1311
+ def widenSingletons (using Context ): Type = this match {
1312
1312
case tp : SingletonType =>
1313
1313
tp.widen
1314
1314
case tp : OrType =>
@@ -1856,11 +1856,11 @@ object Types {
1856
1856
case _ => this
1857
1857
}
1858
1858
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 */
1860
1860
def coveringSet (using Context ): Set [Symbol ] =
1861
1861
(new CoveringSetAccumulator ).apply(Set .empty[Symbol ], this )
1862
1862
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 */
1864
1864
def typeSize (using Context ): Int =
1865
1865
(new TypeSizeAccumulator ).apply(0 , this )
1866
1866
@@ -6178,11 +6178,12 @@ object Types {
6178
6178
6179
6179
class TypeSizeAccumulator (using Context ) extends TypeAccumulator [Int ] {
6180
6180
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
6183
6184
else {
6184
- seen += tp
6185
- tp match {
6185
+ seen += tp0
6186
+ tp0 match {
6186
6187
case tp : AppliedType =>
6187
6188
foldOver(n + 1 , tp)
6188
6189
case tp : RefinedType =>
@@ -6192,23 +6193,24 @@ object Types {
6192
6193
case tp : TypeParamRef =>
6193
6194
apply(n, TypeComparer .bounds(tp))
6194
6195
case _ =>
6195
- foldOver(n, tp )
6196
+ foldOver(n, tp0 )
6196
6197
}
6197
6198
}
6198
6199
}
6199
6200
6200
6201
class CoveringSetAccumulator (using Context ) extends TypeAccumulator [Set [Symbol ]] {
6201
6202
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
6204
6206
else {
6205
- seen += tp
6206
- tp match {
6207
+ seen += tp0
6208
+ tp0 match {
6207
6209
case tp if tp.isExactlyAny || tp.isExactlyNothing =>
6208
6210
cs
6209
- case tp : AppliedType =>
6211
+ case tp : AppliedType if ! tp.typeSymbol.isAliasType =>
6210
6212
foldOver(cs + tp.typeSymbol, tp)
6211
- case tp : RefinedType =>
6213
+ case tp : RefinedType if ! tp.typeSymbol.isAliasType =>
6212
6214
foldOver(cs + tp.typeSymbol, tp)
6213
6215
case tp : TypeRef if tp.info.isTypeAlias =>
6214
6216
apply(cs, tp.superType)
@@ -6220,7 +6222,7 @@ object Types {
6220
6222
case tp : TypeParamRef =>
6221
6223
apply(cs, TypeComparer .bounds(tp))
6222
6224
case other =>
6223
- foldOver(cs, tp )
6225
+ foldOver(cs, tp0 )
6224
6226
}
6225
6227
}
6226
6228
}
0 commit comments