summaryrefslogtreecommitdiff
path: root/test/files/pos/t1260.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-07-11 05:02:16 +0000
committerPaul Phillips <paulp@improving.org>2009-07-11 05:02:16 +0000
commit2bc40d593a84a510ccf18b1666a419f77665fcb4 (patch)
tree085c34b88c3f46ef8aaf8243bcaddd6ac1a51826 /test/files/pos/t1260.scala
parent8ee2c8685d4edb2d0c285aeb6fa9b2a99b8a9e79 (diff)
downloadscala-2bc40d593a84a510ccf18b1666a419f77665fcb4.tar.gz
scala-2bc40d593a84a510ccf18b1666a419f77665fcb4.tar.bz2
scala-2bc40d593a84a510ccf18b1666a419f77665fcb4.zip
Fix and test case for #1260.
Diffstat (limited to 'test/files/pos/t1260.scala')
-rw-r--r--test/files/pos/t1260.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/pos/t1260.scala b/test/files/pos/t1260.scala
new file mode 100644
index 0000000000..9cd860afd8
--- /dev/null
+++ b/test/files/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]) {
+ 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
+ }
+ }
+}
+