summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/CompilationUnits.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-06-10 15:59:23 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-07-04 15:26:52 +0200
commitffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4 (patch)
tree94bdbf3809b8029ced7adb53e9731c79d344c9f9 /src/compiler/scala/tools/nsc/CompilationUnits.scala
parentb38fc5eaac3eb938902fe56a69e44830d41c1f87 (diff)
downloadscala-ffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4.tar.gz
scala-ffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4.tar.bz2
scala-ffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4.zip
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`...
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilationUnits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index c2caed70a0..924bb54ddb 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -146,7 +146,8 @@ trait CompilationUnits { global: Global =>
def incompleteInputError(pos: Position, msg:String) =
reporter.incompleteInputError(pos, msg)
- def comment(pos: Position, msg: String) =
+ // used by the IDE -- TODO: don't use reporter to communicate comments from parser to IDE!
+ def comment(pos: Position, msg: String): Unit =
reporter.comment(pos, msg)
/** Is this about a .java source file? */