@@ -255,7 +255,7 @@ object Types {
255
255
case tp : NamedType => tp.info.isTightPrefix(sym)
256
256
case tp : ClassInfo => tp.cls eq sym
257
257
case tp : Types .ThisType => tp.cls eq sym
258
- case tp : TypeProxy => tp.underlying .isTightPrefix(sym)
258
+ case tp : TypeProxy => tp.superType .isTightPrefix(sym)
259
259
case tp : AndType => tp.tp1.isTightPrefix(sym) && tp.tp2.isTightPrefix(sym)
260
260
case tp : OrType => tp.tp1.isTightPrefix(sym) || tp.tp2.isTightPrefix(sym)
261
261
case _ => false
@@ -331,7 +331,7 @@ object Types {
331
331
val sym = tp.symbol
332
332
if (sym.isClass) sym == defn.AnyKindClass else loop(tp.translucentSuperType)
333
333
case tp : TypeProxy =>
334
- loop(tp.underlying)
334
+ loop(tp.underlying) // underlying OK here since an AnyKinded type cannot be a type argument of another type
335
335
case _ =>
336
336
false
337
337
}
@@ -342,6 +342,7 @@ object Types {
342
342
final def isNotNull (using Context ): Boolean = this match {
343
343
case tp : ConstantType => tp.value.value != null
344
344
case tp : ClassInfo => ! tp.cls.isNullableClass && tp.cls != defn.NothingClass
345
+ case tp : AppliedType => tp.superType.isNotNull
345
346
case tp : TypeBounds => tp.lo.isNotNull
346
347
case tp : TypeProxy => tp.underlying.isNotNull
347
348
case AndType (tp1, tp2) => tp1.isNotNull || tp2.isNotNull
@@ -500,7 +501,7 @@ object Types {
500
501
val sym = tp.symbol
501
502
if (sym.isClass) sym else tp.superType.classSymbol
502
503
case tp : TypeProxy =>
503
- tp.underlying .classSymbol
504
+ tp.superType .classSymbol
504
505
case tp : ClassInfo =>
505
506
tp.cls
506
507
case AndType (l, r) =>
@@ -534,7 +535,7 @@ object Types {
534
535
val sym = tp.symbol
535
536
if (include(sym)) sym :: Nil else tp.superType.parentSymbols(include)
536
537
case tp : TypeProxy =>
537
- tp.underlying .parentSymbols(include)
538
+ tp.superType .parentSymbols(include)
538
539
case tp : ClassInfo =>
539
540
tp.cls :: Nil
540
541
case AndType (l, r) =>
@@ -556,7 +557,7 @@ object Types {
556
557
val sym = tp.symbol
557
558
sym == cls || ! sym.isClass && tp.superType.hasClassSymbol(cls)
558
559
case tp : TypeProxy =>
559
- tp.underlying .hasClassSymbol(cls)
560
+ tp.superType .hasClassSymbol(cls)
560
561
case tp : ClassInfo =>
561
562
tp.cls == cls
562
563
case AndType (l, r) =>
@@ -570,12 +571,14 @@ object Types {
570
571
* bounds of type variables in the constraint.
571
572
*/
572
573
def isMatchableBound (using Context ): Boolean = dealias match
573
- case tp : TypeRef => tp.symbol == defn.MatchableClass
574
+ case tp : TypeRef =>
575
+ val sym = tp.symbol
576
+ sym == defn.MatchableClass || ! sym.isClass && tp.superType.isMatchableBound
574
577
case tp : TypeParamRef =>
575
578
ctx.typerState.constraint.entry(tp) match
576
579
case bounds : TypeBounds => bounds.hi.isMatchableBound
577
580
case _ => false
578
- case tp : TypeProxy => tp.underlying .isMatchableBound
581
+ case tp : TypeProxy => tp.superType .isMatchableBound
579
582
case tp : AndType => tp.tp1.isMatchableBound || tp.tp2.isMatchableBound
580
583
case tp : OrType => tp.tp1.isMatchableBound && tp.tp2.isMatchableBound
581
584
case _ => false
0 commit comments