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 {
20762076 /** Show trace of comparison operations when performing `op` as result string */
20772077 def explaining [T ](say : String => Unit )(op : Context => T )(implicit ctx : Context ): T = {
20782078 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()) }
20812080 res
20822081 }
20832082
20842083 /** Like [[explaining ]], but returns the trace instead */
20852084 def explained [T ](op : Context => T )(implicit ctx : Context ): String = {
20862085 var trace : String = null
2087- explaining(trace = _)(op)
2086+ try { explaining(trace = _)(op) } catch { case ex : Throwable => ex.printStackTrace }
20882087 trace
20892088 }
20902089}
Original file line number Diff line number Diff line change @@ -405,8 +405,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
405405
406406 /** Is `tp1` a subtype of `tp2`? */
407407 def isSubType (tp1 : Type , tp2 : Type ): Boolean = {
408+ debug.println(TypeComparer .explained(implicit ctx => tp1 <:< tp2))
408409 val res = (tp1 != nullType || tp2 == nullType) && tp1 <:< tp2
409- debug.println(s " ${tp1} <:< ${tp2} = $res" )
410410 res
411411 }
412412
You can’t perform that action at this time.
0 commit comments