diff options
author | Paul Phillips <paulp@improving.org> | 2009-08-27 13:21:36 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-08-27 13:21:36 +0000 |
commit | 2c39b8b0839a5dfd48dfd073944f7b176cc63f4b (patch) | |
tree | 98313bcb7ad6f6f0ffffa31bfccc007005bd2362 | |
parent | de8a10cdd1badae2a73c8506a59eebaa1c323312 (diff) | |
download | scala-2c39b8b0839a5dfd48dfd073944f7b176cc63f4b.tar.gz scala-2c39b8b0839a5dfd48dfd073944f7b176cc63f4b.tar.bz2 scala-2c39b8b0839a5dfd48dfd073944f7b176cc63f4b.zip |
Fix and test case for #2187 and its duplicate #...
Fix and test case for #2187 and its duplicate #2192.
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 3 | ||||
-rw-r--r-- | test/files/pos/bug2187.scala | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index e02d13ff23..3278e4508b 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -751,7 +751,8 @@ trait ParallelMatching extends ast.TreeDSL { // ...which means this logic must be applied more broadly than I had inferred from the comment // "...even if [x] failed to match *after* passing its length test." So one would think that means // the second case would only not be tried if scrut.length == 2, and reachable the rest of the time. - case (false, false) => nextLen == firstLen // same length (self compare ruled out up top) + // XXX note this used to say "nextLen == firstLen" and this caused #2187. Rewrite this. + case (false, false) => nextLen >= firstLen // same length (self compare ruled out up top) }) }) diff --git a/test/files/pos/bug2187.scala b/test/files/pos/bug2187.scala new file mode 100644 index 0000000000..087df13ec6 --- /dev/null +++ b/test/files/pos/bug2187.scala @@ -0,0 +1,7 @@ +// bug #2187 +object Test extends Application { + def foo(xs:List[String]) = xs match { + case Seq(x) => x + case Seq(x,y) => "" + } +}
\ No newline at end of file |