summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-03-01 18:23:57 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-03-03 23:29:19 -0800
commit2cf6c5d7e5cfbd60958eac0a545f5c2978a8e5cd (patch)
tree4c3c20875be88faf60f3b5ed93701d455004f7f2 /test
parent5b7cfe3c63c15488ed7d8a9bb3b8d7f2043874d8 (diff)
downloadscala-2cf6c5d7e5cfbd60958eac0a545f5c2978a8e5cd.tar.gz
scala-2cf6c5d7e5cfbd60958eac0a545f5c2978a8e5cd.tar.bz2
scala-2cf6c5d7e5cfbd60958eac0a545f5c2978a8e5cd.zip
[port] SI-7183 Disable unreachability for withFilter matches.
This is a forward port of #2168 (originally for 2.10.1, but the pattern matcher has since been refactored in 2.10.x.)
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t7183.flags1
-rw-r--r--test/files/pos/t7183.scala13
2 files changed, 14 insertions, 0 deletions
diff --git a/test/files/pos/t7183.flags b/test/files/pos/t7183.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7183.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7183.scala b/test/files/pos/t7183.scala
new file mode 100644
index 0000000000..7647c1634b
--- /dev/null
+++ b/test/files/pos/t7183.scala
@@ -0,0 +1,13 @@
+class A
+object A {
+ def unapply(a: A): Some[A] = Some(a) // Change return type to Option[A] and the warning is gone
+}
+
+object Test {
+ for (A(a) <- List(new A)) yield a // spurious dead code warning.
+}
+
+// List(new A()).withFilter(((check$ifrefutable$2) => check$ifrefutable$2: @scala.unchecked match {
+// case A((a @ _)) => true
+// case _ => false // this is dead code, but it's compiler generated.
+// }))