diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-09 17:35:29 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-09 17:35:29 +0000 |
commit | c1aaf1fc7ad3d76bb5376d796577e0effdd70bf4 (patch) | |
tree | d89ddcb0f6b241b9cf1560b538e703cf1760d12e /src/compiler/scala/tools/nsc/interpreter/ILoop.scala | |
parent | 554fb11b0cd2f76d7990a0de935c8deef30f95dc (diff) | |
download | scala-c1aaf1fc7ad3d76bb5376d796577e0effdd70bf4.tar.gz scala-c1aaf1fc7ad3d76bb5376d796577e0effdd70bf4.tar.bz2 scala-c1aaf1fc7ad3d76bb5376d796577e0effdd70bf4.zip |
Don't discard deprecation/unchecked warnings re...
Don't discard deprecation/unchecked warnings regardless of settings.
Changed warnings code to accumulate them rather than thoughtlessly
discarding them and issuing its well-known taunt. In the repl you can
take advantage of this with the :warnings command, which will show the
suppressed warnings from the last line which had any. Be advised that at
the moment it has some issues: unchecked warnings aren't making it out,
and near repl startup neither are deprecation warnings, so don't open a
bunch of tickets please.
References SI-4594, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/ILoop.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/ILoop.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index 2ff8bb343f..457a34f9dc 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -225,7 +225,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) nullary("replay", "reset execution and replay all previous commands", replay), shCommand, nullary("silent", "disable/enable automatic printing of results", verbosity), - cmd("type", "<expr>", "display the type of an expression without evaluating it", typeCommand) + cmd("type", "<expr>", "display the type of an expression without evaluating it", typeCommand), + nullary("warnings", "show the suppressed warnings from the most recent line which had any", warningsCommand) ) /** Power user commands */ @@ -393,6 +394,9 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) case _ => "" // the error message was already printed } } + private def warningsCommand(): Result = { + intp.lastWarnings foreach { case (pos, msg) => intp.reporter.warning(pos, msg) } + } private def javapCommand(line: String): Result = { if (javap == null) |