summaryrefslogtreecommitdiff
path: root/test/files/neg/t6895.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-06-21 06:17:59 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-06-23 08:43:53 +1000
commit1531900bffb2bed6288eda4e0945b0e6dea3f23d (patch)
treec4df9581205cf4e405457052c837520eca13f0ce /test/files/neg/t6895.scala
parenta3beedac5b957e3954be288b1be7c52a1d7d31b0 (diff)
downloadscala-1531900bffb2bed6288eda4e0945b0e6dea3f23d.tar.gz
scala-1531900bffb2bed6288eda4e0945b0e6dea3f23d.tar.bz2
scala-1531900bffb2bed6288eda4e0945b0e6dea3f23d.zip
SI-6895 Test cases to explain the limitations in tcpoly inference
I've determined that the failure in this bug report boils down to SI-2712. Submitting my working as neg tests for posterity. The type error disabmiguator develops a serious stutter with this example. I'll fix that in the following commit.
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
+}