diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-25 01:35:46 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-25 01:35:46 +0000 |
commit | 2bf3a560d6b9c5c187f1b04e1cd687d7a3604bb7 (patch) | |
tree | ee0ca4db3ff79f340c73e45c01a8a0ebaba92cd8 /src | |
parent | 4aa7ec183ea0f9938ced697fce3494234d14e71d (diff) | |
download | scala-2bf3a560d6b9c5c187f1b04e1cd687d7a3604bb7.tar.gz scala-2bf3a560d6b9c5c187f1b04e1cd687d7a3604bb7.tar.bz2 scala-2bf3a560d6b9c5c187f1b04e1cd687d7a3604bb7.zip |
Created -Yfatal-warnings, as otherwise I can't ...
Created -Yfatal-warnings, as otherwise I can't see how to make partest
fail on the presence of an unchecked warning. It'll come in handy
anyway. Now we have a real tough guy's command line for those who want
it:
% scalac -unchecked -deprecation -Yfatal-warnings `find . -name
'*.scala'`
Not for the timid. Review by community.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 4e14ec6fb1..92c72b1549 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -136,7 +136,9 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable // ------------------ Reporting ------------------------------------- def error(msg: String) = reporter.error(NoPosition, msg) - def warning(msg: String) = reporter.warning(NoPosition, msg) + def warning(msg: String) = + if (settings.Ywarnfatal.value) reporter.error(NoPosition, msg) + else reporter.warning(NoPosition, msg) def inform(msg: String) = reporter.info(NoPosition, msg, true) def inform[T](msg: String, value: T): T = { inform(msg+value); value } diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 7cb411ffca..2d88b38777 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -943,6 +943,7 @@ trait ScalacSettings { val Yjenkins = BooleanSetting ("-Yjenkins-hashCodes", "Use jenkins hash algorithm for case class generated hashCodes.") // Warnings + val Ywarnfatal = BooleanSetting ("-Yfatal-warnings", "Fail the compilation if there are any warnings.") val Xwarninit = BooleanSetting ("-Xwarninit", "Warn about possible changes in initialization semantics") val Xchecknull = BooleanSetting ("-Xcheck-null", "Emit warning on selection of nullable reference") val Xwarndeadcode = BooleanSetting ("-Ywarn-dead-code", "Emit warnings for dead code") diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index a2f6b1f247..76daa0d2fe 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -27,15 +27,17 @@ abstract class AbstractReporter extends Reporter { def display(pos: Position, msg: String, severity: Severity): Unit def displayPrompt: Unit - protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean) { + protected def info0(pos: Position, msg: String, _severity: Severity, force: Boolean) { + val severity = if (settings.Ywarnfatal.value) ERROR else WARNING + severity match { case INFO => if (force || settings.verbose.value) display(pos, msg, severity) case WARNING => val hidden = testAndLog(pos, severity) if (!settings.nowarnings.value) { - if (!hidden || settings.prompt.value) display(pos, msg, severity) - if (settings.prompt.value) displayPrompt + if (!hidden || settings.prompt.value) display(pos, msg, severity) + if (settings.prompt.value) displayPrompt } case ERROR => val hidden = testAndLog(pos, severity) |