From 2e0be8323bdef5582a0f5af84b3de83fcc338be4 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 23 Mar 2013 09:48:33 +0100 Subject: 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. --- test/files/neg/t7290.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/files/neg/t7290.scala (limited to 'test/files/neg/t7290.scala') diff --git a/test/files/neg/t7290.scala b/test/files/neg/t7290.scala new file mode 100644 index 0000000000..b9db7f7e8a --- /dev/null +++ b/test/files/neg/t7290.scala @@ -0,0 +1,10 @@ +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 4 | (_ @ 4) => 0 + case _ => -1 + } + assert(y == 0, y) +} -- cgit v1.2.3