File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -1822,20 +1822,17 @@ object TypeComparer {
18221822
18231823 /** Show trace of comparison operations when performing `op` as result string */
18241824 def explaining [T ](say : String => Unit )(op : Context => T )(implicit ctx : Context ): T = {
1825- val (res, explanation) = underlyingExplained(op)
1826- say(explanation)
1825+ val nestedCtx = ctx.fresh.setTypeComparerFn(new ExplainingTypeComparer (_))
1826+ val res = op(nestedCtx)
1827+ say(nestedCtx.typeComparer.lastTrace())
18271828 res
18281829 }
18291830
18301831 /** Like [[explaining ]], but returns the trace instead */
18311832 def explained [T ](op : Context => T )(implicit ctx : Context ): String = {
1832- underlyingExplained(op)._2
1833- }
1834-
1835- private def underlyingExplained [T ](op : Context => T )(implicit ctx : Context ): (T , String ) = {
1836- val nestedCtx = ctx.fresh.setTypeComparerFn(new ExplainingTypeComparer (_))
1837- val res = op(nestedCtx)
1838- (res, nestedCtx.typeComparer.lastTrace())
1833+ var trace : String = null
1834+ explaining(trace = _)(op)
1835+ trace
18391836 }
18401837}
18411838
You can’t perform that action at this time.
0 commit comments