aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/dependent-extractors.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pos/dependent-extractors.scala')
-rw-r--r--tests/pos/dependent-extractors.scala14
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
+}