Skip to content

Commit fb2c793

Browse files
authored
Merge pull request #142 from scala/backport-lts-3.3-21583
Backport: Avoid using ExplainingTypeComparer in regular code
2 parents 5fe893b + 54f1043 commit fb2c793

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -704,20 +704,18 @@ object TypeOps:
704704
val hiBound = instantiate(bounds.hi, skolemizedArgTypes)
705705
val loBound = instantiate(bounds.lo, skolemizedArgTypes)
706706

707-
def check(tp1: Type, tp2: Type, which: String, bound: Type)(using Context) = {
708-
val isSub = TypeComparer.explaining { cmp =>
709-
val isSub = cmp.isSubType(tp1, tp2)
710-
if !isSub then
711-
if !ctx.typerState.constraint.domainLambdas.isEmpty then
712-
typr.println(i"${ctx.typerState.constraint}")
713-
if !ctx.gadt.symbols.isEmpty then
714-
typr.println(i"${ctx.gadt}")
715-
typr.println(cmp.lastTrace(i"checkOverlapsBounds($lo, $hi, $arg, $bounds)($which)"))
716-
//trace.dumpStack()
717-
isSub
718-
}//(using ctx.fresh.setSetting(ctx.settings.verbose, true)) // uncomment to enable moreInfo in ExplainingTypeComparer recur
719-
if !isSub then violations += ((arg, which, bound))
720-
}
707+
def check(tp1: Type, tp2: Type, which: String, bound: Type)(using Context) =
708+
val isSub = TypeComparer.isSubType(tp1, tp2)
709+
if !isSub then
710+
// inContext(ctx.fresh.setSetting(ctx.settings.verbose, true)): // uncomment to enable moreInfo in ExplainingTypeComparer
711+
TypeComparer.explaining: cmp =>
712+
if !ctx.typerState.constraint.domainLambdas.isEmpty then
713+
typr.println(i"${ctx.typerState.constraint}")
714+
if !ctx.gadt.symbols.isEmpty then
715+
typr.println(i"${ctx.gadt}")
716+
typr.println(cmp.lastTrace(i"checkOverlapsBounds($lo, $hi, $arg, $bounds)($which)"))
717+
violations += ((arg, which, bound))
718+
721719
check(lo, hiBound, "upper", hiBound)(using checkCtx)
722720
check(loBound, hi, "lower", loBound)(using checkCtx)
723721
}

0 commit comments

Comments
 (0)