From c854cc7fcc9d0f889c6235c1534133cff7360e7f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 17 Mar 2014 18:44:39 +0100 Subject: More tests --- tests/pos/t1260.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/pos/t1260.scala (limited to 'tests/pos/t1260.scala') diff --git a/tests/pos/t1260.scala b/tests/pos/t1260.scala new file mode 100644 index 000000000..02f9e7e6b --- /dev/null +++ b/tests/pos/t1260.scala @@ -0,0 +1,18 @@ +case class Foo(a: String, b: String) + +object Bar { + def unapply(s: String): Option[Long] = + try { Some(s.toLong) } catch { case _ => None } +} + +object Test { + def main(args: Array[String]): Unit = { + val f = Foo("1", "2") + f match { + case Foo(Bar(1), Bar(2)) => 1 + case Foo(Bar(i), Bar(j)) if i >= 0 => 2 + case _ => 3 + } + } +} + -- cgit v1.2.3