summaryrefslogtreecommitdiff
path: root/test/files/run/t7290.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-03-23 09:48:33 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-03-23 11:26:39 +0100
commit2e0be8323bdef5582a0f5af84b3de83fcc338be4 (patch)
tree90486886b1888185fdba7b9b5bfb57384545c54e /test/files/run/t7290.scala
parent62dd51a79ef1b1c240c1eb1e97c330347f842d4c (diff)
downloadscala-2e0be8323bdef5582a0f5af84b3de83fcc338be4.tar.gz
scala-2e0be8323bdef5582a0f5af84b3de83fcc338be4.tar.bz2
scala-2e0be8323bdef5582a0f5af84b3de83fcc338be4.zip
SI-7290 Discard duplicates in switchable alternative patterns.
The pattern matcher must not allow duplicates to hit the backend when generating switches. It already eliminates then if they appear on different cases (with an unreachability warning.) This commit does the same for duplicated literal patterns in an alternative pattern: discard and warn.
Diffstat (limited to 'test/files/run/t7290.scala')
-rw-r--r--test/files/run/t7290.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/run/t7290.scala b/test/files/run/t7290.scala
new file mode 100644
index 0000000000..01f7e8f68e
--- /dev/null
+++ b/test/files/run/t7290.scala
@@ -0,0 +1,9 @@
+object Test extends App {
+ val y = (0: Int) match {
+ case 1 => 1
+ case 0 | 0 => 0
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ case _ => -1
+ }
+ assert(y == 0, y)
+}