diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-03-23 09:48:33 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-03-23 11:26:39 +0100 |
commit | 2e0be8323bdef5582a0f5af84b3de83fcc338be4 (patch) | |
tree | 90486886b1888185fdba7b9b5bfb57384545c54e /test/files/neg/t7290.check | |
parent | 62dd51a79ef1b1c240c1eb1e97c330347f842d4c (diff) | |
download | scala-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/neg/t7290.check')
-rw-r--r-- | test/files/neg/t7290.check | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/files/neg/t7290.check b/test/files/neg/t7290.check new file mode 100644 index 0000000000..15f30e8bce --- /dev/null +++ b/test/files/neg/t7290.check @@ -0,0 +1,10 @@ +t7290.scala:4: error: Pattern contains duplicate alternatives: 0 + case 0 | 0 => 0 + ^ +t7290.scala:5: error: Pattern contains duplicate alternatives: 2, 2, 2, 3 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + ^ +t7290.scala:6: error: Pattern contains duplicate alternatives: 4 + case 4 | (_ @ 4) => 0 + ^ +three errors found |