From 4804efef205adbe359dd353d51ab16e1e0337dc5 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 13 Apr 2012 20:15:10 +0200 Subject: virtpatmat on by default; chicken out: -Xoldpatmat some tests (unreachability, exhaustivity, @switch annotation checking) are still run under -Xoldpatmat, but that will change before we go into RC mode (then the test/ partest of this commit will be reverted) removed irrelevant dependency on patmat --- test/files/neg/array-not-seq.check | 12 +++++++++--- test/files/neg/exhausting.flags | 2 +- test/files/neg/gadts1.check | 5 ++++- test/files/neg/pat_unreachable.flags | 1 + test/files/neg/patmat-type-check.check | 14 +++++++++++++- test/files/neg/patmatexhaust.flags | 2 +- test/files/neg/sealed-java-enums.flags | 2 +- test/files/neg/switch.flags | 1 + test/files/neg/t0418.check | 5 ++++- test/files/neg/t112706A.check | 5 ++++- test/files/neg/t1878.check | 5 ++++- test/files/neg/t3098.flags | 2 +- test/files/neg/t3392.check | 5 ++++- test/files/neg/t3683a.flags | 2 +- test/files/neg/t3692.flags | 1 + test/files/neg/t418.check | 5 ++++- test/files/neg/t4425.check | 2 +- test/files/neg/t5589neg.check | 5 ++++- test/files/neg/tailrec.check | 6 +++--- test/files/neg/unreachablechar.flags | 1 + 20 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 test/files/neg/pat_unreachable.flags create mode 100644 test/files/neg/switch.flags create mode 100644 test/files/neg/t3692.flags create mode 100644 test/files/neg/unreachablechar.flags (limited to 'test/files/neg') diff --git a/test/files/neg/array-not-seq.check b/test/files/neg/array-not-seq.check index c16ecdad72..a3a639e772 100644 --- a/test/files/neg/array-not-seq.check +++ b/test/files/neg/array-not-seq.check @@ -1,7 +1,13 @@ array-not-seq.scala:2: error: An Array will no longer match as Seq[_]. def f1(x: Any) = x.isInstanceOf[Seq[_]] ^ -error: An Array will no longer match as Seq[_]. -error: An Array will no longer match as Seq[_]. -error: An Array will no longer match as Seq[_]. +array-not-seq.scala:4: error: An Array will no longer match as Seq[_]. + case _: Seq[_] => true + ^ +array-not-seq.scala:16: error: An Array will no longer match as Seq[_]. + case (Some(_: Seq[_]), Nil, _) => 1 + ^ +array-not-seq.scala:17: error: An Array will no longer match as Seq[_]. + case (None, List(_: List[_], _), _) => 2 + ^ four errors found diff --git a/test/files/neg/exhausting.flags b/test/files/neg/exhausting.flags index e8fb65d50c..b7eb21d5f5 100644 --- a/test/files/neg/exhausting.flags +++ b/test/files/neg/exhausting.flags @@ -1 +1 @@ --Xfatal-warnings \ No newline at end of file +-Xfatal-warnings -Xoldpatmat diff --git a/test/files/neg/gadts1.check b/test/files/neg/gadts1.check index 44d2b114d6..0441f604c9 100644 --- a/test/files/neg/gadts1.check +++ b/test/files/neg/gadts1.check @@ -11,4 +11,7 @@ gadts1.scala:20: error: type mismatch; required: a case Cell[a](x: Int) => c.x = 5 ^ -three errors found +gadts1.scala:20: error: Could not typecheck extractor call: case class with arguments List((x @ (_: Int))) + case Cell[a](x: Int) => c.x = 5 + ^ +four errors found diff --git a/test/files/neg/pat_unreachable.flags b/test/files/neg/pat_unreachable.flags new file mode 100644 index 0000000000..ba80cad69b --- /dev/null +++ b/test/files/neg/pat_unreachable.flags @@ -0,0 +1 @@ +-Xoldpatmat diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check index e045841ce1..ab4451f089 100644 --- a/test/files/neg/patmat-type-check.check +++ b/test/files/neg/patmat-type-check.check @@ -3,19 +3,31 @@ patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type; required: String def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail ^ +patmat-type-check.scala:22: error: value _1 is not a member of object Seq + def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail + ^ patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Array[Char] def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail ^ +patmat-type-check.scala:23: error: value _1 is not a member of object Seq + def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail + ^ patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Test.Bop2 def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail ^ +patmat-type-check.scala:27: error: value _1 is not a member of object Seq + def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail + ^ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Test.Bop3[Char] def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail ^ -four errors found +patmat-type-check.scala:30: error: value _1 is not a member of object Seq + def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail + ^ +8 errors found diff --git a/test/files/neg/patmatexhaust.flags b/test/files/neg/patmatexhaust.flags index e8fb65d50c..b7eb21d5f5 100644 --- a/test/files/neg/patmatexhaust.flags +++ b/test/files/neg/patmatexhaust.flags @@ -1 +1 @@ --Xfatal-warnings \ No newline at end of file +-Xfatal-warnings -Xoldpatmat diff --git a/test/files/neg/sealed-java-enums.flags b/test/files/neg/sealed-java-enums.flags index e709c65918..312f3a87ec 100644 --- a/test/files/neg/sealed-java-enums.flags +++ b/test/files/neg/sealed-java-enums.flags @@ -1 +1 @@ --Xexperimental -Xfatal-warnings +-Xexperimental -Xfatal-warnings -Xoldpatmat diff --git a/test/files/neg/switch.flags b/test/files/neg/switch.flags new file mode 100644 index 0000000000..809e9ff2f2 --- /dev/null +++ b/test/files/neg/switch.flags @@ -0,0 +1 @@ + -Xoldpatmat diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check index 4e9ad2f9ae..50931a1bca 100644 --- a/test/files/neg/t0418.check +++ b/test/files/neg/t0418.check @@ -4,4 +4,7 @@ t0418.scala:2: error: not found: value Foo12340771 t0418.scala:2: error: not found: value x null match { case Foo12340771.Bar(x) => x } ^ -two errors found +t0418.scala:2: error: Could not typecheck extractor call: case class with arguments List((x @ _)) + null match { case Foo12340771.Bar(x) => x } + ^ +three errors found diff --git a/test/files/neg/t112706A.check b/test/files/neg/t112706A.check index 30d0c3ec91..fb18b31be1 100644 --- a/test/files/neg/t112706A.check +++ b/test/files/neg/t112706A.check @@ -3,4 +3,7 @@ t112706A.scala:5: error: constructor cannot be instantiated to expected type; required: String case Tuple2(node,_) => ^ -one error found +t112706A.scala:5: error: Could not typecheck extractor call: case class Tuple2 with arguments List((node @ _), _) + case Tuple2(node,_) => + ^ +two errors found diff --git a/test/files/neg/t1878.check b/test/files/neg/t1878.check index 128741a022..b47367e12c 100644 --- a/test/files/neg/t1878.check +++ b/test/files/neg/t1878.check @@ -9,10 +9,13 @@ t1878.scala:3: error: scrutinee is incompatible with pattern type; t1878.scala:3: error: not found: value f val err1 = "" match { case Seq(f @ _*, ',') => f } ^ +t1878.scala:3: error: value _2 is not a member of object Seq + val err1 = "" match { case Seq(f @ _*, ',') => f } + ^ t1878.scala:9: error: _* may only come last val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6)) ^ t1878.scala:13: error: _* may only come last case

{ _* }

=> ^ -5 errors found +6 errors found diff --git a/test/files/neg/t3098.flags b/test/files/neg/t3098.flags index e8fb65d50c..b7eb21d5f5 100644 --- a/test/files/neg/t3098.flags +++ b/test/files/neg/t3098.flags @@ -1 +1 @@ --Xfatal-warnings \ No newline at end of file +-Xfatal-warnings -Xoldpatmat diff --git a/test/files/neg/t3392.check b/test/files/neg/t3392.check index 842d63eec9..3a39098c4e 100644 --- a/test/files/neg/t3392.check +++ b/test/files/neg/t3392.check @@ -1,4 +1,7 @@ t3392.scala:9: error: not found: value x case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) => ^ -one error found +t3392.scala:9: error: Could not typecheck extractor call: case class with arguments List(42) + case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) => + ^ +two errors found diff --git a/test/files/neg/t3683a.flags b/test/files/neg/t3683a.flags index 85d8eb2ba2..b7eb21d5f5 100644 --- a/test/files/neg/t3683a.flags +++ b/test/files/neg/t3683a.flags @@ -1 +1 @@ --Xfatal-warnings +-Xfatal-warnings -Xoldpatmat diff --git a/test/files/neg/t3692.flags b/test/files/neg/t3692.flags new file mode 100644 index 0000000000..82becdfbfd --- /dev/null +++ b/test/files/neg/t3692.flags @@ -0,0 +1 @@ + -Xoldpatmat \ No newline at end of file diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check index 1489547823..c06088ba9d 100644 --- a/test/files/neg/t418.check +++ b/test/files/neg/t418.check @@ -4,4 +4,7 @@ t418.scala:2: error: not found: value Foo12340771 t418.scala:2: error: not found: value x null match { case Foo12340771.Bar(x) => x } ^ -two errors found +t418.scala:2: error: Could not typecheck extractor call: case class with arguments List((x @ _)) + null match { case Foo12340771.Bar(x) => x } + ^ +three errors found diff --git a/test/files/neg/t4425.check b/test/files/neg/t4425.check index 4ff4b1eec0..0f2fe6f2d1 100644 --- a/test/files/neg/t4425.check +++ b/test/files/neg/t4425.check @@ -1,4 +1,4 @@ -t4425.scala:3: error: erroneous or inaccessible type +t4425.scala:3: error: isInstanceOf cannot test if value types are references. 42 match { case _ X _ => () } ^ one error found diff --git a/test/files/neg/t5589neg.check b/test/files/neg/t5589neg.check index b3ff16d7e4..fb6858a397 100644 --- a/test/files/neg/t5589neg.check +++ b/test/files/neg/t5589neg.check @@ -22,6 +22,9 @@ t5589neg.scala:4: error: constructor cannot be instantiated to expected type; t5589neg.scala:4: error: not found: value y2 def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2)) ^ +t5589neg.scala:4: error: Could not typecheck extractor call: case class Tuple1 with arguments List((y2 @ _)) + def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2)) + ^ t5589neg.scala:5: error: constructor cannot be instantiated to expected type; found : (T1, T2, T3) required: (String, Int) @@ -34,4 +37,4 @@ t5589neg.scala:5: error: not found: value y2 def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2)) ^ two warnings found -7 errors found +8 errors found diff --git a/test/files/neg/tailrec.check b/test/files/neg/tailrec.check index ad92731b2c..946d3421e6 100644 --- a/test/files/neg/tailrec.check +++ b/test/files/neg/tailrec.check @@ -4,9 +4,9 @@ tailrec.scala:45: error: could not optimize @tailrec annotated method facfail: i tailrec.scala:50: error: could not optimize @tailrec annotated method fail1: it is neither private nor final so can be overridden @tailrec def fail1(x: Int): Int = fail1(x) ^ -tailrec.scala:55: error: could not optimize @tailrec annotated method fail2: it contains a recursive call not in tail position - case x :: xs => x :: fail2[T](xs) - ^ +tailrec.scala:53: error: could not optimize @tailrec annotated method fail2: it contains a recursive call not in tail position + @tailrec final def fail2[T](xs: List[T]): List[T] = xs match { + ^ tailrec.scala:59: error: could not optimize @tailrec annotated method fail3: it is called recursively with different type arguments @tailrec final def fail3[T](x: Int): Int = fail3(x - 1) ^ diff --git a/test/files/neg/unreachablechar.flags b/test/files/neg/unreachablechar.flags new file mode 100644 index 0000000000..809e9ff2f2 --- /dev/null +++ b/test/files/neg/unreachablechar.flags @@ -0,0 +1 @@ + -Xoldpatmat -- cgit v1.2.3