@@ -124,7 +124,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
124
124
pendingSubTypes = new mutable.HashSet [(Type , Type )]
125
125
ctx.log(s " !!! deep subtype recursion involving ${tp1.show} <:< ${tp2.show}, constraint = ${state.constraint.show}" )
126
126
ctx.log(s " !!! constraint = ${constraint.show}" )
127
- if ( ctx.settings.YnoDeepSubtypes .value) throw new Error (" deep subtype" )
127
+ assert( ! ctx.settings.YnoDeepSubtypes .value) // throw new Error("deep subtype")
128
128
if (Config .traceDeepSubTypeRecursions && ! this .isInstanceOf [ExplainingTypeComparer ])
129
129
ctx.log(TypeComparer .explained(implicit ctx => ctx.typeComparer.isSubType(tp1, tp2)))
130
130
}
@@ -598,7 +598,11 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
598
598
other.isInstanceOf [TypeRef ] &&
599
599
args.length == other.typeParams.length && {
600
600
val applied = other.appliedTo(argRefs(rt, args.length))
601
- if (inOrder) isSubType(body, applied) else isSubType(applied, body)
601
+ if (inOrder) isSubType(body, applied)
602
+ else body match {
603
+ case body : TypeBounds => body.contains(applied)
604
+ case _ => isSubType(applied, body)
605
+ }
602
606
}
603
607
case _ =>
604
608
false
@@ -1233,7 +1237,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1233
1237
1234
1238
/** Show subtype goal that led to an assertion failure */
1235
1239
def showGoal (tp1 : Type , tp2 : Type )(implicit ctx : Context ) = {
1236
- ctx. println(disambiguated(implicit ctx => s " assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint" ))
1240
+ println(disambiguated(implicit ctx => s " assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint" ))
1237
1241
def explainPoly (tp : Type ) = tp match {
1238
1242
case tp : PolyParam => ctx.println(s " polyparam ${tp.show} found in ${tp.binder.show}" )
1239
1243
case tp : TypeRef if tp.symbol.exists => ctx.println(s " typeref ${tp.show} found in ${tp.symbol.owner.show}" )
@@ -1323,10 +1327,17 @@ class ExplainingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
1323
1327
1324
1328
override def compareHkApply (projection : NamedType , other : Type , inOrder : Boolean ) =
1325
1329
if (projection.name == tpnme.hkApply)
1326
- traceIndented(i " compareHK $projection, $other, $inOrder" ) {
1330
+ traceIndented(i " compareHkApply $projection, $other, $inOrder" ) {
1327
1331
super .compareHkApply(projection, other, inOrder)
1328
1332
}
1329
1333
else super .compareHkApply(projection, other, inOrder)
1330
1334
1335
+ override def compareHkLambda (rt : RefinedType , other : Type , inOrder : Boolean ) =
1336
+ if (rt.refinedName == tpnme.hkApply)
1337
+ traceIndented(i " compareHkLambda $rt, $other, $inOrder" ) {
1338
+ super .compareHkLambda(rt, other, inOrder)
1339
+ }
1340
+ else super .compareHkLambda(rt, other, inOrder)
1341
+
1331
1342
override def toString = " Subtype trace:" + { try b.toString finally b.clear() }
1332
1343
}
0 commit comments