diff options
Diffstat (limited to 'tests/untried/pos/t1260.scala')
-rw-r--r-- | tests/untried/pos/t1260.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/untried/pos/t1260.scala b/tests/untried/pos/t1260.scala new file mode 100644 index 000000000..02f9e7e6b --- /dev/null +++ b/tests/untried/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 + } + } +} + |