aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-18 12:55:07 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-18 13:09:21 +0200
commit60be18cce509bae1ed0d6c68b910f4bed10fa889 (patch)
tree00eb2520cf6562d2484e43088590f5cf869189a0 /tests/neg
parent7c0c1f31fda704e790ca7a9d260c8c956b28d447 (diff)
downloaddotty-60be18cce509bae1ed0d6c68b910f4bed10fa889.tar.gz
dotty-60be18cce509bae1ed0d6c68b910f4bed10fa889.tar.bz2
dotty-60be18cce509bae1ed0d6c68b910f4bed10fa889.zip
Add test case
Also fix reviewers comments about `firstParent`
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
+ }
+ }
+}