File tree 1 file changed +6
-9
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -1822,20 +1822,17 @@ object TypeComparer {
1822
1822
1823
1823
/** Show trace of comparison operations when performing `op` as result string */
1824
1824
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())
1827
1828
res
1828
1829
}
1829
1830
1830
1831
/** Like [[explaining ]], but returns the trace instead */
1831
1832
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
1839
1836
}
1840
1837
}
1841
1838
You can’t perform that action at this time.
0 commit comments