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/t8511.scala | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/patmat/t8511.scala (limited to 'tests/patmat/t8511.scala') diff --git a/tests/patmat/t8511.scala b/tests/patmat/t8511.scala new file mode 100644 index 000000000..bc7f64713 --- /dev/null +++ b/tests/patmat/t8511.scala @@ -0,0 +1,25 @@ +sealed trait Expr +final case class Foo(other: Option[String]) extends Expr +final case class Bar(someConstant: String) extends Expr +final case class Baz() extends Expr +final case class EatsExhaustiveWarning(other: Reference) extends Expr + +sealed trait Reference { + val value: String +} + +object Reference { + def unapply(reference: Reference): Option[(String)] = { + Some(reference.value) + } +} + +object EntryPoint { + private def logic(head: Expr): String = head match { + case Foo(_) => + ??? + // Commenting this line only causes the exhaustive search warning to be emitted + case EatsExhaustiveWarning(Reference(text)) => + ??? + } +} \ No newline at end of file -- cgit v1.2.3