From ffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 10 Jun 2014 15:59:23 +0200 Subject: Unclutter Reporter. Move truncation to ReplReporter. Refactor to reduce the Reporter interface. Working towards minimal interfaces in scala.reflect.internal that can be consumed by sbt/IDE/.... The scala.tools.nsc package is entirely private to the compiler (in principle). A `Reporter` should only be used to inform (info/warning/error). No state. Ideally, we'd move to having only one reporter, whose lifetime is adjusted appropriately (from per-run in general to per-context for type checking, so errors can be buffered -- "silenced" -- during nested type checking calls). Start the clean up by moving truncation to the REPL, since it's not relevant for regular reporting. Perversely, we were checking truncation all the time, even though it's only on during a repl run. (Truncation is now always turned off in the repl under -verbose.) Untangle error resetting on symbols from error reporting (reportAdditionalErrors). This fixes a nice&subtle bug that caused feature warnings to be suppressed under `-Xfatal-warnings`: ``` def reportCompileErrors() { if (!reporter.hasErrors && reporter.hasWarnings && settings.fatalWarnings) globalError("No warnings can be incurred under -Xfatal-warnings.") if (reporter.hasErrors) { ... } else { // will erroneously not get here if // `reporter.hasWarnings && settings.fatalWarnings` // since the `globalError` call above means `reporter.hasErrors`... allConditionalWarnings foreach (_.summarize()) ... } } ``` The second `if`'s condition depends on the `globalError` call in the first `if`... --- test/files/neg/checksensible.check | 3 ++- test/files/neg/overloaded-implicit.check | 3 ++- test/files/neg/t6567.check | 3 ++- test/files/neg/unchecked-refinement.check | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index e5f1a38d96..38cc5ec447 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -98,5 +98,6 @@ checksensible.scala:95: warning: comparing values of types Unit and Int using `! while ((c = in.read) != -1) ^ error: No warnings can be incurred under -Xfatal-warnings. +error: there were 3 deprecation warnings; re-run with -deprecation for details 33 warnings found -one error found +two errors found diff --git a/test/files/neg/overloaded-implicit.check b/test/files/neg/overloaded-implicit.check index ca0870705d..d9594d126a 100644 --- a/test/files/neg/overloaded-implicit.check +++ b/test/files/neg/overloaded-implicit.check @@ -5,5 +5,6 @@ overloaded-implicit.scala:3: warning: parameterized overloaded implicit methods implicit def imp1[T](x: Set[T]): Map[T, T] = Map() ^ error: No warnings can be incurred under -Xfatal-warnings. +error: there were 4 feature warnings; re-run with -feature for details two warnings found -one error found +two errors found diff --git a/test/files/neg/t6567.check b/test/files/neg/t6567.check index a733d75354..3243fde0cd 100644 --- a/test/files/neg/t6567.check +++ b/test/files/neg/t6567.check @@ -5,5 +5,6 @@ t6567.scala:10: warning: Suspicious application of an implicit view (Test.this.a val b: Option[B] = Option(a) ^ error: No warnings can be incurred under -Xfatal-warnings. +error: there was one feature warning; re-run with -feature for details two warnings found -one error found +two errors found diff --git a/test/files/neg/unchecked-refinement.check b/test/files/neg/unchecked-refinement.check index e85a51f44d..b49e47fcbb 100644 --- a/test/files/neg/unchecked-refinement.check +++ b/test/files/neg/unchecked-refinement.check @@ -11,5 +11,6 @@ unchecked-refinement.scala:24: warning: a pattern match on a refinement type is /* nowarn - todo */ case x: AnyRef { def size: Int } if b => x.size // this could/should do a static conformance test and not warn ^ error: No warnings can be incurred under -Xfatal-warnings. +error: there was one feature warning; re-run with -feature for details four warnings found -one error found +two errors found -- cgit v1.2.3