diff options
author | Martin Odersky <odersky@gmail.com> | 2016-04-27 18:05:15 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-04-27 18:07:33 +0200 |
commit | d7c1c27b0765b33811326e3cf02dcd4aa12b6cd8 (patch) | |
tree | 0dcca4fb37ba79d531567789bf3600997ade0684 /tests | |
parent | 3129c1c136d5fa8b1549ec940ea1856c135bfe85 (diff) | |
download | dotty-d7c1c27b0765b33811326e3cf02dcd4aa12b6cd8.tar.gz dotty-d7c1c27b0765b33811326e3cf02dcd4aa12b6cd8.tar.bz2 dotty-d7c1c27b0765b33811326e3cf02dcd4aa12b6cd8.zip |
Allow dependent method type for unapply.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/dependent-extractors.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/pos/dependent-extractors.scala b/tests/pos/dependent-extractors.scala new file mode 100644 index 000000000..4d0830155 --- /dev/null +++ b/tests/pos/dependent-extractors.scala @@ -0,0 +1,14 @@ +object Test { + + abstract class C { type T; val x: T } + + val c = new C { type T = Int; val x = 1 } + + object X { def unapply(x: C): Some[x.T] = Some(x.x) } + + val y = c match { case X(y) => y } + val y1: Int = y + + val z = (c: Any) match { case X(y) => y } + val z1: C#T = z +} |