summaryrefslogtreecommitdiff
path: root/test/files/neg/t6895.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg/t6895.scala')
-rw-r--r--test/files/neg/t6895.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/neg/t6895.scala b/test/files/neg/t6895.scala
new file mode 100644
index 0000000000..5fb20d8c61
--- /dev/null
+++ b/test/files/neg/t6895.scala
@@ -0,0 +1,26 @@
+trait Foo[F1[F1_P]]
+trait Bar[F2[F2_P]]
+
+class Test {
+ def barFoo[F3[F3_P]]: Foo[F3] = ???
+
+ // Now we can define a couple of type aliases:
+ type M[X1] = String
+ type N[X2] = Bar[M]
+
+ // val ok1: Foo[N] = barFoo
+ // Foo[?F3] <:< Foo[Test.this.N]
+ // [X2]Test.this.N[X2] <:< [F3_P]?F3[F3_P]
+ // Test.this.N[X2] <:< ?F3[X2]
+ // true, ?F3=N
+
+ // val ok2: Foo[({type L[X] = Bar[M]})#L] = barFoo[N]
+
+ val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */
+ // Foo[?F3] <:< Foo[[X3]Bar[[X1]String]]
+ // [X3]Bar[[X1]String] <:< ?F3
+ // [X3]Bar[[X1]String] <:< [F3_P]?F3[F3_P]
+ // Bar[[X1]String] <:< ?F3[X3]
+ // X3 <:< [X1]String
+ // false
+}