From c1aaf1fc7ad3d76bb5376d796577e0effdd70bf4 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 9 Aug 2011 17:35:29 +0000 Subject: 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. --- test/files/run/repl-suppressed-warnings.check | 58 +++++++++++++++++++++++++++ test/files/run/repl-suppressed-warnings.scala | 26 ++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 test/files/run/repl-suppressed-warnings.check create mode 100644 test/files/run/repl-suppressed-warnings.scala (limited to 'test/files') diff --git a/test/files/run/repl-suppressed-warnings.check b/test/files/run/repl-suppressed-warnings.check new file mode 100644 index 0000000000..0c449f348c --- /dev/null +++ b/test/files/run/repl-suppressed-warnings.check @@ -0,0 +1,58 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> + +scala> // "Is this thing on?" Not working on first couple + +scala> // commands, needs investigation. + +scala> 123 +res0: Int = 123 + +scala> 123 +res1: Int = 123 + +scala> 123 +res2: Int = 123 + +scala> + +scala> object o { + case class Bippy() + case class Dingus { + def f[T](xs: TraversableOnce[T]) = xs match { + case _: List[Int] => 1 + case _: Set[String] => 2 + case _ => xs.isInstanceOf[Iterator[Double]] + } + } + case class DingDangDoobie(ding: Int, dang: Int, doobie: Double) + case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x +} +warning: there were 4 deprecation warnings; re-run with -deprecation for details +warning: there were 3 unchecked warnings; re-run with -unchecked for details +defined module o + +scala> :warnings +:3: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. + case class Dingus { + ^ +:11: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. + case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x + ^ +:11: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. + case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x + ^ +:11: warning: for comprehension assignment without a `val' declaration is deprecated. + case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x + ^ + +scala> + +scala> diff --git a/test/files/run/repl-suppressed-warnings.scala b/test/files/run/repl-suppressed-warnings.scala new file mode 100644 index 0000000000..5ecc16f34c --- /dev/null +++ b/test/files/run/repl-suppressed-warnings.scala @@ -0,0 +1,26 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + +// "Is this thing on?" Not working on first couple +// commands, needs investigation. +123 +123 +123 + +object o { + case class Bippy() + case class Dingus { + def f[T](xs: TraversableOnce[T]) = xs match { + case _: List[Int] => 1 + case _: Set[String] => 2 + case _ => xs.isInstanceOf[Iterator[Double]] + } + } + case class DingDangDoobie(ding: Int, dang: Int, doobie: Double) + case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x +} +:warnings + """ +} -- cgit v1.2.3