diff options
author | Paul Phillips <paulp@improving.org> | 2011-04-28 16:26:05 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-04-28 16:26:05 +0000 |
commit | c5d9b7e6a99f253d6da941610c58d9d9e1a02925 (patch) | |
tree | 461c02007998ff775201b6860843b555f4ae3bfc /src/compiler/scala/tools/nsc/reporters | |
parent | 199ec3c10fe7d2b2029ea8ae6a19240b46181435 (diff) | |
download | scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.gz scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.bz2 scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.zip |
I wrote a warning when nullary methods return U...
I wrote a warning when nullary methods return Unit. I wimped out of
including it in this patch because we had about 200 of them, and that's
what is fixed in this patch. I will add the warning to some kind of
"-Xlint" feature after 2.9.
This is motivated at least partly by the resolution of #4506, which
indicates the distinction between "def foo()" and "def foo" will
continue to jab its pointy stick into our eyes, so I believe we have a
minimal duty of at least following our own advice about what they mean
and not making a semirandom choice as to whether a method has parens or
not. Review by community.
Diffstat (limited to 'src/compiler/scala/tools/nsc/reporters')
3 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index 2ffaa1c80a..7d2c0fe424 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -16,7 +16,7 @@ import scala.tools.nsc.util.Position abstract class AbstractReporter extends Reporter { private val positions = new HashMap[Position, Severity] - override def reset { + override def reset() { super.reset positions.clear } @@ -27,7 +27,7 @@ abstract class AbstractReporter extends Reporter { private def isPromptSet = settings.prompt.value def display(pos: Position, msg: String, severity: Severity): Unit - def displayPrompt: Unit + def displayPrompt(): Unit protected def info0(pos: Position, msg: String, _severity: Severity, force: Boolean) { val severity = diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index 93e6f77dbd..75c25afa5b 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -94,7 +94,7 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr print(pos, msg, severity) } - def displayPrompt: Unit = try { + def displayPrompt(): Unit = try { var continue = true while (continue) { writer.print("r)esume, a)bort: ") diff --git a/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala b/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala index bc08478490..9f0e55c422 100644 --- a/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala @@ -27,7 +27,7 @@ class StoreReporter extends Reporter { } } - override def reset { + override def reset() { super.reset infos.clear } |