@@ -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
@@ -501,7 +502,7 @@ object Types {
501
502
val sym = tp.symbol
502
503
if (sym.isClass) sym else tp.superType.classSymbol
503
504
case tp : TypeProxy =>
504
- tp.underlying .classSymbol
505
+ tp.superType .classSymbol
505
506
case tp : ClassInfo =>
506
507
tp.cls
507
508
case AndType (l, r) =>
@@ -535,7 +536,7 @@ object Types {
535
536
val sym = tp.symbol
536
537
if (include(sym)) sym :: Nil else tp.superType.parentSymbols(include)
537
538
case tp : TypeProxy =>
538
- tp.underlying .parentSymbols(include)
539
+ tp.superType .parentSymbols(include)
539
540
case tp : ClassInfo =>
540
541
tp.cls :: Nil
541
542
case AndType (l, r) =>
@@ -557,7 +558,7 @@ object Types {
557
558
val sym = tp.symbol
558
559
sym == cls || ! sym.isClass && tp.superType.hasClassSymbol(cls)
559
560
case tp : TypeProxy =>
560
- tp.underlying .hasClassSymbol(cls)
561
+ tp.superType .hasClassSymbol(cls)
561
562
case tp : ClassInfo =>
562
563
tp.cls == cls
563
564
case AndType (l, r) =>
@@ -571,12 +572,14 @@ object Types {
571
572
* bounds of type variables in the constraint.
572
573
*/
573
574
def isMatchableBound (using Context ): Boolean = dealias match
574
- case tp : TypeRef => tp.symbol == defn.MatchableClass
575
+ case tp : TypeRef =>
576
+ val sym = tp.symbol
577
+ sym == defn.MatchableClass || ! sym.isClass && tp.superType.isMatchableBound
575
578
case tp : TypeParamRef =>
576
579
ctx.typerState.constraint.entry(tp) match
577
580
case bounds : TypeBounds => bounds.hi.isMatchableBound
578
581
case _ => false
579
- case tp : TypeProxy => tp.underlying .isMatchableBound
582
+ case tp : TypeProxy => tp.superType .isMatchableBound
580
583
case tp : AndType => tp.tp1.isMatchableBound || tp.tp2.isMatchableBound
581
584
case tp : OrType => tp.tp1.isMatchableBound && tp.tp2.isMatchableBound
582
585
case _ => false
0 commit comments