diff options
author | Paul Phillips <paulp@improving.org> | 2012-08-10 07:29:31 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-08-10 12:28:50 -0700 |
commit | fbbbb2294680c0f57506f885971b148cae53c92d (patch) | |
tree | d2500556943fd4a63cad5752a0aa5a0caf3b329d /src/compiler/scala/tools/nsc/Global.scala | |
parent | 7dd0ead39ceb7cd6f445d86f37c68b78218eef57 (diff) | |
download | scala-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/scala/tools/nsc/Global.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 7 |
1 files changed, 4 insertions, 3 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)) |