summaryrefslogtreecommitdiff
path: root/test/files/pos/unapply.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/unapply.scala')
-rw-r--r--test/files/pos/unapply.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/pos/unapply.scala b/test/files/pos/unapply.scala
index 17577ef991..49f7181350 100644
--- a/test/files/pos/unapply.scala
+++ b/test/files/pos/unapply.scala
@@ -6,3 +6,22 @@ object Test {
}
}
}
+
+// the following comes from ticket #230
+trait Foo {
+ def name : String
+ def unapply(x : String) : Option[Unit] = {
+ if(x == name) Some(()) else None
+ }
+}
+object Bar extends Foo { def name = "bar" }
+object Baz extends Foo { def name = "baz" }
+
+object Test_ {
+ def matcher(s : String) = s match {
+ case Bar(x) => println("bar")
+ case Baz(x) => println("baz")
+// ^
+// error: unreachable code
+ }
+ }