aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
Diffstat (limited to 'tests/neg')
-rw-r--r--tests/neg/patmat.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/neg/patmat.scala b/tests/neg/patmat.scala
new file mode 100644
index 000000000..e2ab9874e
--- /dev/null
+++ b/tests/neg/patmat.scala
@@ -0,0 +1,24 @@
+trait A
+trait B
+class C extends A with B
+case class D()
+object X {
+ def unapply(x: B): Boolean = false
+}
+
+object Test {
+ def main(args: Array[String]) = {
+ val ca: A = new C
+ ca match {
+ case x: B =>
+ case X() =>
+ case D() => // error: neither a subtype not a supertype
+ }
+ val cc = new C
+ cc match {
+ case x: B =>
+ case X() =>
+ case D() => // error: neither a subtype not a supertype
+ }
+ }
+}