File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -2076,15 +2076,14 @@ object TypeComparer {
2076
2076
/** Show trace of comparison operations when performing `op` as result string */
2077
2077
def explaining [T ](say : String => Unit )(op : Context => T )(implicit ctx : Context ): T = {
2078
2078
val nestedCtx = ctx.fresh.setTypeComparerFn(new ExplainingTypeComparer (_))
2079
- val res = op(nestedCtx)
2080
- say(nestedCtx.typeComparer.lastTrace())
2079
+ val res = try { op(nestedCtx) } finally { say(nestedCtx.typeComparer.lastTrace()) }
2081
2080
res
2082
2081
}
2083
2082
2084
2083
/** Like [[explaining ]], but returns the trace instead */
2085
2084
def explained [T ](op : Context => T )(implicit ctx : Context ): String = {
2086
2085
var trace : String = null
2087
- explaining(trace = _)(op)
2086
+ try { explaining(trace = _)(op) } catch { case ex : Throwable => ex.printStackTrace }
2088
2087
trace
2089
2088
}
2090
2089
}
Original file line number Diff line number Diff line change @@ -405,8 +405,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
405
405
406
406
/** Is `tp1` a subtype of `tp2`? */
407
407
def isSubType (tp1 : Type , tp2 : Type ): Boolean = {
408
+ debug.println(TypeComparer .explained(implicit ctx => tp1 <:< tp2))
408
409
val res = (tp1 != nullType || tp2 == nullType) && tp1 <:< tp2
409
- debug.println(s " ${tp1} <:< ${tp2} = $res" )
410
410
res
411
411
}
412
412
You can’t perform that action at this time.
0 commit comments