From d0af55ce1ffb9d77e6a604edb41cda2b955e9f02 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 8 Oct 2013 21:20:23 +0200 Subject: SI-7895 Avoid cascade of "symbol not found" in pattern matches If we can't type check the `Foo` in `case Foo(a, b) => (a, b)`, we should enter error symbols for `a` and `b` to avoid further errors being reported in the case body. --- test/files/neg/t0418.check | 5 +---- test/files/neg/t418.check | 5 +---- test/files/neg/t545.check | 5 +---- test/files/neg/t5903a.check | 5 +---- test/files/neg/t5903b.check | 5 +---- test/files/neg/t5903c.check | 5 +---- test/files/neg/t5903d.check | 5 +---- test/files/neg/t7895.check | 4 ++++ test/files/neg/t7895.scala | 6 ++++++ test/files/neg/t997.check | 5 +---- 10 files changed, 18 insertions(+), 32 deletions(-) create mode 100644 test/files/neg/t7895.check create mode 100644 test/files/neg/t7895.scala (limited to 'test/files/neg') diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check index 4e9ad2f9ae..b95f8e4e1b 100644 --- a/test/files/neg/t0418.check +++ b/test/files/neg/t0418.check @@ -1,7 +1,4 @@ t0418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t0418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check index 1489547823..1b99717b82 100644 --- a/test/files/neg/t418.check +++ b/test/files/neg/t418.check @@ -1,7 +1,4 @@ t418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t545.check b/test/files/neg/t545.check index 8ebbf9bdf6..aae575fa96 100644 --- a/test/files/neg/t545.check +++ b/test/files/neg/t545.check @@ -1,7 +1,4 @@ t545.scala:4: error: value blah is not a member of Test.Foo val x = foo.blah match { ^ -t545.scala:5: error: recursive value x needs type - case List(x) => x - ^ -two errors found +one error found diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check index cbdcfd1bdd..2e5cc87167 100644 --- a/test/files/neg/t5903a.check +++ b/test/files/neg/t5903a.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3 case nq"$x + $y + $z" => println((x, y)) ^ -Test_2.scala:4: error: not found: value x - case nq"$x + $y + $z" => println((x, y)) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903b.check b/test/files/neg/t5903b.check index faeb73ad03..e7637d3edb 100644 --- a/test/files/neg/t5903b.check +++ b/test/files/neg/t5903b.check @@ -3,7 +3,4 @@ Test_2.scala:4: error: type mismatch; required: String case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903c.check b/test/files/neg/t5903c.check index c9476edd11..05bd775d30 100644 --- a/test/files/neg/t5903c.check +++ b/test/files/neg/t5903c.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: String is not supported case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903d.check b/test/files/neg/t5903d.check index d5d3fdcc28..9b8526b7f5 100644 --- a/test/files/neg/t5903d.check +++ b/test/files/neg/t5903d.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: extractor macros can only expand into extractor calls case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t7895.check b/test/files/neg/t7895.check new file mode 100644 index 0000000000..1a58e24b77 --- /dev/null +++ b/test/files/neg/t7895.check @@ -0,0 +1,4 @@ +t7895.scala:4: error: not found: value Goop + case Goop(a, b, c) => Tuple2(a, b) + ^ +one error found diff --git a/test/files/neg/t7895.scala b/test/files/neg/t7895.scala new file mode 100644 index 0000000000..87a586a82d --- /dev/null +++ b/test/files/neg/t7895.scala @@ -0,0 +1,6 @@ +class A { + (null: Any) match { + // We don't want "symbol not found errors" for `a` and `b` in the case body. + case Goop(a, b, c) => Tuple2(a, b) + } +} diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index be1e92c369..8c41060ba2 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -4,7 +4,4 @@ t997.scala:13: error: wrong number of patterns for object Foo offering (String, 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)) } ^ -t997.scala:13: error: not found: value a -"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } - ^ -three errors found +two errors found -- cgit v1.2.3