From cc02243fbe8b7290265e1bdf540e4c2f256df199 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Thu, 21 Jul 2016 10:45:14 +0200 Subject: add test set for exhaustivity and redundancy check --- tests/patmat/exhausting.check | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/patmat/exhausting.check (limited to 'tests/patmat/exhausting.check') diff --git a/tests/patmat/exhausting.check b/tests/patmat/exhausting.check new file mode 100644 index 000000000..790b12334 --- /dev/null +++ b/tests/patmat/exhausting.check @@ -0,0 +1,25 @@ +./tests/patmat/exhausting.scala:21: warning: match may not be exhaustive. +It would fail on the following input: List(_), List(_, _, _) + def fail1[T](xs: List[T]) = xs match { + ^ +./tests/patmat/exhausting.scala:27: warning: match may not be exhaustive. +It would fail on the following input: Nil + def fail2[T](xs: List[T]) = xs match { + ^ +./tests/patmat/exhausting.scala:32: warning: match may not be exhaustive. +It would fail on the following input: List(_, _) + def fail3a(xs: List[Int]) = xs match { + ^ +./tests/patmat/exhausting.scala:39: warning: match may not be exhaustive. +It would fail on the following input: Bar3 + def fail3[T](x: Foo[T]) = x match { + ^ +./tests/patmat/exhausting.scala:44: warning: match may not be exhaustive. +It would fail on the following input: (Bar2, Bar2) + def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { + ^ +./tests/patmat/exhausting.scala:53: warning: match may not be exhaustive. +It would fail on the following input: (Bar2, Bar2), (Bar2, Bar1), (Bar1, Bar3), (Bar1, Bar2) + def fail5[T](xx: (Foo[T], Foo[T])) = xx match { + ^ +6 warnings found -- cgit v1.2.3