diff options
author | odersky <odersky@gmail.com> | 2016-07-18 17:30:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-18 17:30:08 +0200 |
commit | 61aa3d9efb31182d83f4b5f6bb7f5788da5b111c (patch) | |
tree | 39289dc966fc8aad5eb3d1ed4c22672d97116862 /tests/neg | |
parent | a307a90c1a5f498087612894c3a923a299d02a66 (diff) | |
parent | 198817b3d55f3a3df4f320622e60515f05da3aa0 (diff) | |
download | dotty-61aa3d9efb31182d83f4b5f6bb7f5788da5b111c.tar.gz dotty-61aa3d9efb31182d83f4b5f6bb7f5788da5b111c.tar.bz2 dotty-61aa3d9efb31182d83f4b5f6bb7f5788da5b111c.zip |
Merge pull request #1399 from dotty-staging/fix-patmat-typing
Fix typing of match expressions
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/i1212.scala | 1 | ||||
-rw-r--r-- | tests/neg/patmat.scala | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/neg/i1212.scala b/tests/neg/i1212.scala new file mode 100644 index 000000000..b009a4d2c --- /dev/null +++ b/tests/neg/i1212.scala @@ -0,0 +1 @@ +@ann class ann extends scala.annotation.Annotation // error: cyclic reference diff --git a/tests/neg/patmat.scala b/tests/neg/patmat.scala new file mode 100644 index 000000000..1e72c104a --- /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() => // ok, but scalac disagrees + } + val cc = new C + cc match { + case x: B => + case X() => + case D() => // error: neither a subtype not a supertype + } + } +} |