From 11bfa25e37d32f4017d5c04b4899b1bdfbd95e06 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 15 Dec 2013 18:28:03 -0800 Subject: 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. --- test/files/neg/t997.check | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'test/files/neg/t997.check') diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index 8c41060ba2..b118792229 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -1,7 +1,4 @@ -t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 +t997.scala:13: error: too many patterns for object Foo offering (String, String): expected 2, found 3 "x" match { case Foo(a, b, c) => Console.println((a,b,c)) } ^ -t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 -"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } - ^ -two errors found +one error found -- cgit v1.2.3