diff options
author | Paul Phillips <paulp@improving.org> | 2013-12-15 18:28:03 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-12-15 18:28:03 -0800 |
commit | 11bfa25e37d32f4017d5c04b4899b1bdfbd95e06 (patch) | |
tree | 42fab30ce189d1bc93fbecb5496448a7176ba5e9 /test/files/neg/t4425b.check | |
parent | dbe7a366c994fe359edc368bfcd8a6a35a00e0da (diff) | |
download | scala-11bfa25e37d32f4017d5c04b4899b1bdfbd95e06.tar.gz scala-11bfa25e37d32f4017d5c04b4899b1bdfbd95e06.tar.bz2 scala-11bfa25e37d32f4017d5c04b4899b1bdfbd95e06.zip |
SI-7897, SI-6675 improves name-based patmat
This emerges from a recent attempt to eliminate pattern matcher
related duplication and to bake the scalac-independent logic
out of it. I had in mind something a lot cleaner, but it was
a whole lot of work to get it here and I can take it no further.
Key file to admire is PatternExpander.scala, which should
provide a basis for some separation of concerns.
The bugs addressed are a CCE involving Tuple1 and an imprecise
warning regarding multiple pattern crushing.
Editorial: auto-tupling unapply results was a terrible idea which
should never have escaped from the crib. It is tantamount to
purposely throwing type safety down the toilet in the very place
where people need type safety the most. See SI-6111 and SI-6675 for
some other comments.
Diffstat (limited to 'test/files/neg/t4425b.check')
-rw-r--r-- | test/files/neg/t4425b.check | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/test/files/neg/t4425b.check b/test/files/neg/t4425b.check index 1186e8b609..ae7b469d52 100644 --- a/test/files/neg/t4425b.check +++ b/test/files/neg/t4425b.check @@ -22,40 +22,28 @@ t4425b.scala:10: error: object X is not a case class constructor, nor does it ha Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:18: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:18: error: too many patterns for object X: expected 1, found 2 println( "" match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:19: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:19: error: too many patterns for object X: expected 1, found 2 println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:22: error: too many patterns for object X: expected 1, found 2 println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:23: error: too many patterns for object X: expected 1, found 2 println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:31: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:31: error: too many patterns for object X offering Nothing: expected 1, found 2 println( "" match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:32: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:32: error: too many patterns for object X offering Nothing: expected 1, found 2 println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:35: error: too many patterns for object X offering Nothing: expected 1, found 2 println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:36: error: too many patterns for object X offering Nothing: expected 1, found 2 println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -18 errors found +14 errors found |