summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-10 07:29:31 -0700
committerPaul Phillips <paulp@improving.org>2012-08-10 12:28:50 -0700
commitfbbbb2294680c0f57506f885971b148cae53c92d (patch)
treed2500556943fd4a63cad5752a0aa5a0caf3b329d /src/compiler
parent7dd0ead39ceb7cd6f445d86f37c68b78218eef57 (diff)
downloadscala-fbbbb2294680c0f57506f885971b148cae53c92d.tar.gz
scala-fbbbb2294680c0f57506f885971b148cae53c92d.tar.bz2
scala-fbbbb2294680c0f57506f885971b148cae53c92d.zip
Made -Xfatal-warnings less immediately fatal.
Instead of changing warnings to errors mid-stream, at the end of a run I check for condition "no errors, some warnings, and fatal warnings" and then generate an error at that point. This is necessary to test for some warnings which come from later stages.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala7
-rw-r--r--src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala6
2 files changed, 5 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 056ae2f809..3f4c51748c 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -222,9 +222,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
def error(msg: String) = globalError(msg)
def globalError(msg: String) = reporter.error(NoPosition, msg)
def inform(msg: String) = reporter.echo(msg)
- def warning(msg: String) =
- if (settings.fatalWarnings.value) globalError(msg)
- else reporter.warning(NoPosition, msg)
+ def warning(msg: String) = reporter.warning(NoPosition, msg)
// Getting in front of Predef's asserts to supplement with more info.
// This has the happy side effect of masking the one argument forms
@@ -1481,6 +1479,9 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
}
def reportCompileErrors() {
+ if (!reporter.hasErrors && reporter.hasWarnings && settings.fatalWarnings.value)
+ globalError("No warnings can be incurred under -Xfatal-warnings.")
+
if (reporter.hasErrors) {
for ((sym, file) <- symSource.iterator) {
sym.reset(new loaders.SourcefileLoader(file))
diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
index 491718bc0d..fdf82ece71 100644
--- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
@@ -29,11 +29,7 @@ abstract class AbstractReporter extends Reporter {
private def noWarnings = settings.nowarnings.value
private def isPromptSet = settings.prompt.value
- protected def info0(pos: Position, msg: String, _severity: Severity, force: Boolean) {
- val severity =
- if (settings.fatalWarnings.value && _severity == WARNING) ERROR
- else _severity
-
+ protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean) {
if (severity == INFO) {
if (isVerbose || force) {
severity.count += 1