summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-04-27 10:37:56 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-04-27 10:37:56 -0700
commit3da1abe3a2e2752588ca8e2c7e889a321dae2037 (patch)
tree6357dcd07c064d80059283db67fe87c8a0bf8519 /test/files/pos
parent0a23852d9b434d7aef734687474b1c3e79881a9b (diff)
parent62713964b96f64f9c0fd0070c89aa6571679856d (diff)
downloadscala-3da1abe3a2e2752588ca8e2c7e889a321dae2037.tar.gz
scala-3da1abe3a2e2752588ca8e2c7e889a321dae2037.tar.bz2
scala-3da1abe3a2e2752588ca8e2c7e889a321dae2037.zip
Merge pull request #2439 from retronym/ticket/7369
SI-7369 Avoid spurious unreachable warnings in patterns
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t7369.flags1
-rw-r--r--test/files/pos/t7369.scala37
2 files changed, 38 insertions, 0 deletions
diff --git a/test/files/pos/t7369.flags b/test/files/pos/t7369.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/pos/t7369.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/pos/t7369.scala b/test/files/pos/t7369.scala
new file mode 100644
index 0000000000..2f31c93d29
--- /dev/null
+++ b/test/files/pos/t7369.scala
@@ -0,0 +1,37 @@
+object Test {
+ val X, Y = true
+ (null: Tuple1[Boolean]) match {
+ case Tuple1(X) =>
+ case Tuple1(Y) => // unreachable
+ case _ =>
+ }
+}
+
+
+sealed abstract class B;
+case object True extends B;
+case object False extends B;
+
+object Test2 {
+
+ val X: B = True
+ val Y: B = False
+
+ (null: Tuple1[B]) match {
+ case Tuple1(X) =>
+ case Tuple1(Y) => // no warning
+ case _ =>
+ }
+}
+
+object Test3 {
+ val X, O = true
+ def classify(neighbourhood: (Boolean, Boolean, Boolean)): String = {
+ neighbourhood match {
+ case (X, X, X) => "middle"
+ case (X, X, O) => "right"
+ case (O, X, X) => "left"
+ case _ => throw new IllegalArgumentException("Invalid")
+ }
+ }
+} \ No newline at end of file