@@ -925,10 +925,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
925
925
case tycon2 : TypeRef =>
926
926
isMatchingApply(tp1) || {
927
927
tycon2.info match {
928
- case tycon2 : TypeBounds =>
929
- compareLower(tycon2 , tyconIsTypeRef = true )
930
- case tycon2 : ClassInfo =>
931
- val base = tp1.baseType(tycon2 .cls)
928
+ case info2 : TypeBounds =>
929
+ compareLower(info2 , tyconIsTypeRef = true )
930
+ case info2 : ClassInfo =>
931
+ val base = tp1.baseType(info2 .cls)
932
932
if (base.exists && base.ne(tp1)) isSubType(base, tp2)
933
933
else fourthTry(tp1, tp2)
934
934
case _ =>
@@ -976,8 +976,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
976
976
case tp2 : TypeBounds =>
977
977
tp2.contains(tp1)
978
978
case _ =>
979
- (v > 0 || isSubType(tp2, tp1)) &&
980
- (v < 0 || isSubType(tp1, tp2))
979
+ tp1 match {
980
+ case TypeBounds (lo1, hi1) =>
981
+ hi1 <:< tp2 && tp2 <:< lo1 // this can succeed in case tp2 bounds are bad
982
+ case _ =>
983
+ (v > 0 || isSubType(tp2, tp1)) &&
984
+ (v < 0 || isSubType(tp1, tp2))
985
+ }
981
986
}
982
987
isSub(args1.head, args2.head)
983
988
} && isSubArgs(args1.tail, args2.tail, tparams.tail)
0 commit comments