diff options
author | odersky <odersky@gmail.com> | 2016-07-15 13:11:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 13:11:52 +0200 |
commit | 409c6c30c8496529aace68967acccf88850145da (patch) | |
tree | 56fd30bbb5d108b895982da72943e649a58fbd40 /tests/neg/existentials.scala | |
parent | 1c02c56213cf22010c0aef1dc1446300fe8005fe (diff) | |
parent | 894c9fbf247765041fc32788c78b85f1b2b2a191 (diff) | |
download | dotty-409c6c30c8496529aace68967acccf88850145da.tar.gz dotty-409c6c30c8496529aace68967acccf88850145da.tar.bz2 dotty-409c6c30c8496529aace68967acccf88850145da.zip |
Merge pull request #1343 from dotty-staging/change-hk-direct2
Direct representation of higher-kinded types
Diffstat (limited to 'tests/neg/existentials.scala')
-rw-r--r-- | tests/neg/existentials.scala | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/neg/existentials.scala b/tests/neg/existentials.scala new file mode 100644 index 000000000..4798504d9 --- /dev/null +++ b/tests/neg/existentials.scala @@ -0,0 +1,61 @@ +object TestList { + + var x: ([X] -> List[List[X]])[_] = List(List(1)) // error: unreducible + var y: ([X] -> List[Seq[X]])[_] = List(List(1)) // error: unreducible + + x = x + y = y + y = x + + val h = x.head + val x1: List[_] = h + + var z: List[_] = x + +} +object TestSet { + + var x: ([Y] -> Set[Set[Y]])[_] = Set(Set("a")) // error: unreducible + var y: ([Y] -> Set[Iterable[Y]])[_] = Set(Set("a")) // error: unreducible + + x = x + y = y + + val h = x.head + val h1: Set[_] = h + + // val p = x.+ // infinite loop in implicit search + + var z: Set[_] = x + +} +class TestX { + + class C[T](x: T) { + def get: T = x + def cmp: T => Boolean = (x == _) + } + + val x: ([Y] -> C[C[Y]])[_] = new C(new C("a")) // error: unreducible + + type CC[X] = C[C[X]] + val y: CC[_] = ??? // error: unreducible + + type D[X] <: C[X] + + type DD = [X] -> D[D[X]] + val z: DD[_] = ??? // error: unreducible + + val g = x.get + + val c = x.cmp +} + +object Test6014 { + 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) } // error: unreducible application +} + |