summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-15 11:29:12 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-01-15 11:29:12 +0100
commit78019b29745b5f9c12c51994b17f1679a74665cf (patch)
tree92d40fc5000532c3b7dbe0a999e7186547e0016b
parent692372ce1d82d0ba41461b9539fdc85238477464 (diff)
downloadscala-78019b29745b5f9c12c51994b17f1679a74665cf.tar.gz
scala-78019b29745b5f9c12c51994b17f1679a74665cf.tar.bz2
scala-78019b29745b5f9c12c51994b17f1679a74665cf.zip
SI-6675 Test new warning under -Xoldpatmat.
This commit should be discarded when merging to master.
-rw-r--r--test/files/neg/t6675-old-patmat.check4
-rw-r--r--test/files/neg/t6675-old-patmat.flags1
-rw-r--r--test/files/neg/t6675-old-patmat.scala13
3 files changed, 18 insertions, 0 deletions
diff --git a/test/files/neg/t6675-old-patmat.check b/test/files/neg/t6675-old-patmat.check
new file mode 100644
index 0000000000..bc3920da06
--- /dev/null
+++ b/test/files/neg/t6675-old-patmat.check
@@ -0,0 +1,4 @@
+t6675-old-patmat.scala:10: error: extractor pattern binds a single value to a Product3 of type (Int, Int, Int)
+ "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111
+ ^
+one error found
diff --git a/test/files/neg/t6675-old-patmat.flags b/test/files/neg/t6675-old-patmat.flags
new file mode 100644
index 0000000000..604de64a62
--- /dev/null
+++ b/test/files/neg/t6675-old-patmat.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings -Xoldpatmat \ No newline at end of file
diff --git a/test/files/neg/t6675-old-patmat.scala b/test/files/neg/t6675-old-patmat.scala
new file mode 100644
index 0000000000..4d500b77ba
--- /dev/null
+++ b/test/files/neg/t6675-old-patmat.scala
@@ -0,0 +1,13 @@
+object X {
+ def unapply(s: String): Option[(Int,Int,Int)] = Some((1,2,3))
+}
+
+object Y {
+ def unapplySeq(s: String): Option[Seq[(Int,Int,Int)]] = Some(Seq((1,2,3)))
+}
+
+object Test {
+ "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111
+
+ "" match { case Y(b) => b } // no warning
+}