summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-14 20:55:26 +0000
committerPaul Phillips <paulp@improving.org>2010-12-14 20:55:26 +0000
commit69aa78bd1bc593f878e44b2abde61dbb56391204 (patch)
treee3399528a7fd7ed74fdd76f8f5c84ae25979a1da /test/files
parent799bd96931386ab3bfa160e738dbf10fb42c0efe (diff)
downloadscala-69aa78bd1bc593f878e44b2abde61dbb56391204.tar.gz
scala-69aa78bd1bc593f878e44b2abde61dbb56391204.tar.bz2
scala-69aa78bd1bc593f878e44b2abde61dbb56391204.zip
Fixed various issues with -Ywarn-dead-code.
enjoy fewer spurious warnings. Closes #1681, no review.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/check-dead.check7
-rw-r--r--test/files/neg/check-dead.flags1
-rw-r--r--test/files/neg/check-dead.scala34
3 files changed, 42 insertions, 0 deletions
diff --git a/test/files/neg/check-dead.check b/test/files/neg/check-dead.check
new file mode 100644
index 0000000000..be4de3060b
--- /dev/null
+++ b/test/files/neg/check-dead.check
@@ -0,0 +1,7 @@
+check-dead.scala:27: error: dead code following this construct
+ throw new Exception
+ ^
+check-dead.scala:31: error: dead code following this construct
+ throw new Exception
+ ^
+two errors found
diff --git a/test/files/neg/check-dead.flags b/test/files/neg/check-dead.flags
new file mode 100644
index 0000000000..c7d406c649
--- /dev/null
+++ b/test/files/neg/check-dead.flags
@@ -0,0 +1 @@
+-Ywarn-dead-code -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/check-dead.scala b/test/files/neg/check-dead.scala
new file mode 100644
index 0000000000..851e81d886
--- /dev/null
+++ b/test/files/neg/check-dead.scala
@@ -0,0 +1,34 @@
+package dummy
+
+object Error {
+ def soSorry(msg: String = "sorry"): Nothing =
+ throw new Exception("we have a problem: "+msg)
+}
+
+class NoDeads {
+ def x = synchronized { throw new Exception }
+ def y[T](arg: T) = println("foo")
+ def z = this.y(throw new Exception)
+
+ def dummy1: Int = synchronized {
+ val i = 10 + 2
+ return i
+ }
+ def dummy1b: Int = synchronized {
+ val i = 10 + 2
+ i
+ }
+
+ def dummy2: String = Error.soSorry("we're dummies")
+}
+
+class Deads {
+ def x1 = synchronized {
+ throw new Exception
+ 5 * 5
+ }
+ def x2: Int = synchronized {
+ throw new Exception
+ return 5
+ }
+} \ No newline at end of file