aboutsummaryrefslogtreecommitdiff
path: root/tests/pos-scala2/t6014.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-07 15:14:37 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:07 +0200
commitfd62c7b6dc6882f658ba2d614cb95a7141842929 (patch)
tree961a38a2a1f2090e42162490223a627dd424cc03 /tests/pos-scala2/t6014.scala
parenteebb4b07bf3011de56f297e7d5357cbc1ee7d623 (diff)
downloaddotty-fd62c7b6dc6882f658ba2d614cb95a7141842929.tar.gz
dotty-fd62c7b6dc6882f658ba2d614cb95a7141842929.tar.bz2
dotty-fd62c7b6dc6882f658ba2d614cb95a7141842929.zip
Disallow higher-kinded types that simulate general existential types
We cannot handle such types in general. So we now check that a hk application C[args] where some of the arguments are wildcards does not have as a supertype a hk application ([X] -> B)[args]
Diffstat (limited to 'tests/pos-scala2/t6014.scala')
-rw-r--r--tests/pos-scala2/t6014.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/pos-scala2/t6014.scala b/tests/pos-scala2/t6014.scala
new file mode 100644
index 000000000..02535f377
--- /dev/null
+++ b/tests/pos-scala2/t6014.scala
@@ -0,0 +1,13 @@
+object Test {
+ case class CC[T](key: T)
+ type Alias[T] = Seq[CC[T]]
+
+ def f(xs: Seq[CC[_]]) = xs map { case CC(x) => CC(x) } // ok
+ def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // migration warning: unreducible application
+ // ./a.scala:11: error: missing parameter type for expanded function
+ // The argument types of an anonymous function must be fully known. (SLS 8.5)
+ // Expected type was: ?
+ // def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // fails
+ // ^
+ // one error found
+}