diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-18 05:40:27 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-18 05:40:27 +0000 |
commit | 23e5428008fc88377e59a1a5c20d5476c586d62e (patch) | |
tree | 45a0eb248c9d7c11674c6d0484c009518197d0d4 /test/files/neg/bug1878.check | |
parent | cf2f9d7fbe4311b2373957b4bc78520984f4eafc (diff) | |
download | scala-23e5428008fc88377e59a1a5c20d5476c586d62e.tar.gz scala-23e5428008fc88377e59a1a5c20d5476c586d62e.tar.bz2 scala-23e5428008fc88377e59a1a5c20d5476c586d62e.zip |
Tighter pattern matching hits the street.
is final and does not conform to the pattern, it will no longer compile.
See all the exciting things you can no longer do:
"bob".reverse match { case Seq('b', 'o', 'b') => true } // denied!
"bob".toArray match { case Seq('b', 'o', 'b') => true } // rejected!
final class Dunk
def f3(x: Dunk) = x match { case Seq('b', 'o', 'b') => true } // uh-uh!
And so forth. Review by odersky.
Diffstat (limited to 'test/files/neg/bug1878.check')
-rw-r--r-- | test/files/neg/bug1878.check | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/files/neg/bug1878.check b/test/files/neg/bug1878.check index 5484d675af..f760781fa0 100644 --- a/test/files/neg/bug1878.check +++ b/test/files/neg/bug1878.check @@ -1,10 +1,15 @@ bug1878.scala:3: error: _* may only come last val err1 = "" match { case Seq(f @ _*, ',') => f } ^ +bug1878.scala:3: error: scrutinee is incompatible with pattern type; + found : Seq[A] + required: java.lang.String + val err1 = "" match { case Seq(f @ _*, ',') => f } + ^ bug1878.scala:9: error: _* may only come last val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6)) ^ bug1878.scala:13: error: _* may only come last case <p> { _* } </p> => ^ -three errors found +four errors found |