diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 11 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 72b9247c5..6e7a79306 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -219,6 +219,17 @@ abstract class Reporter { def hasErrors = count(ERROR.level) > 0 def hasWarnings = count(WARNING.level) > 0 + def isSilent[T](op: => Unit): Boolean = { + val prevCount = count.clone + op + var i = 0 + while (i < count.length) { + if (prevCount(i) != count(i)) return false + i += 1 + } + true + } + /** Returns a string meaning "n elements". */ private def countElementsAsString(n: Int, elements: String): String = n match { diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 3dac39854..ddd95fde1 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -110,13 +110,14 @@ object Inferencing { } /** Type single argument and remember the unadapted result in `myTypedArg`. - * used to avoid repreated typings of trees when backtracking. + * used to avoid repeated typings of trees when backtracking. */ def typedArg(arg: untpd.Tree, formal: Type)(implicit ctx: Context): Tree = { var targ = myTypedArg(arg) if (targ == null) { - targ = typer.typedUnadapted(arg, formal) - myTypedArg = myTypedArg.updated(arg, targ) + if (ctx.typerState.reporter.isSilent { + targ = typer.typedUnadapted(arg, formal) + }) myTypedArg = myTypedArg.updated(arg, targ) } typer.adapt(targ, formal) } |