@@ -152,6 +152,10 @@ object Types {
152152 case tp : TypeRef =>
153153 val sym = tp.symbol
154154 if (sym.isClass) sym.derivesFrom(cls) else tp.underlying.derivesFrom(cls)
155+ case tp : TypeLambda =>
156+ tp.resType.derivesFrom(cls)
157+ case tp : HKApply =>
158+ tp.tycon.derivesFrom(cls)
155159 case tp : TypeProxy =>
156160 tp.underlying.derivesFrom(cls)
157161 case tp : AndType =>
@@ -458,6 +462,8 @@ object Types {
458462 goParam(tp)
459463 case tp : RecType =>
460464 goRec(tp)
465+ case tp : HKApply =>
466+ go(tp.upperBound)
461467 case tp : TypeProxy =>
462468 go(tp.underlying)
463469 case tp : ClassInfo =>
@@ -512,6 +518,7 @@ object Types {
512518 if (! rt.openedTwice) rt.opened = false
513519 }
514520 }
521+
515522 def goRefined (tp : RefinedType ) = {
516523 val pdenot = go(tp.parent)
517524 val rinfo = tp.refinedInfo
@@ -540,6 +547,7 @@ object Types {
540547 safeIntersection = ctx.pendingMemberSearches.contains(name))
541548 }
542549 }
550+
543551 def goThis (tp : ThisType ) = {
544552 val d = go(tp.underlying)
545553 if (d.exists)
@@ -2708,14 +2716,14 @@ object Types {
27082716 /** A higher kinded type application `C[T_1, ..., T_n]` */
27092717 abstract case class HKApply (tycon : Type , args : List [Type ])
27102718 extends CachedProxyType with ValueType {
2711- override def underlying (implicit ctx : Context ): Type = tycon
2719+ override def underlying (implicit ctx : Context ): Type = upperBound
27122720 def derivedAppliedType (tycon : Type , args : List [Type ])(implicit ctx : Context ): Type =
27132721 if ((tycon eq this .tycon) && (args eq this .args)) this
27142722 else tycon.appliedTo(args)
27152723
27162724 override def computeHash = doHash(tycon, args)
27172725
2718- def upperBound (implicit ctx : Context ): Type = tycon.stripTypeVar match {
2726+ def upperBound (implicit ctx : Context ): Type = tycon match {
27192727 case tp : TypeProxy => tp.underlying.appliedTo(args)
27202728 case _ => defn.AnyType
27212729 }
0 commit comments