diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-08 22:02:22 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:16:37 +0100 |
commit | 5962a931c83622ce065bc1ce9add049ade89bfcf (patch) | |
tree | 24851bbc76f1ca537456715c44a9f866a5c00668 /tests/pickling/hk.scala | |
parent | 19bfc0c6c9be9c4c3fdca55480e01e980a493b42 (diff) | |
download | dotty-5962a931c83622ce065bc1ce9add049ade89bfcf.tar.gz dotty-5962a931c83622ce065bc1ce9add049ade89bfcf.tar.bz2 dotty-5962a931c83622ce065bc1ce9add049ade89bfcf.zip |
Pickling test reorg
Move pickling tests into separate top-level test directory.
That way they are not needlessly pos-tested before.
Also, disable core tests for now - after rebasing we get a stale symbol error.
Need to investigate that.
Diffstat (limited to 'tests/pickling/hk.scala')
-rw-r--r-- | tests/pickling/hk.scala | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/pickling/hk.scala b/tests/pickling/hk.scala new file mode 100644 index 000000000..9fdaf94f6 --- /dev/null +++ b/tests/pickling/hk.scala @@ -0,0 +1,56 @@ +import language.higherKinds + +object hk0 { + + abstract class Base { + type Rep[T] + val strRep: Rep[String] + } + + class Sub extends Base { + type Rep[T] = T + val strRep = "abc" + val sr: Rep[String] = "" + } + + abstract class Functor[F[_]] { + def map[A, B](f: A => B): F[A] => F[B] + } + val ml: Functor[List] = ??? + val mx = ml + val mm: (Int => Boolean) => List[Int] => List[Boolean] = mx.map +} + +object higherKinded { + + type Untyped = Null + + class Tree[-T >: Untyped] { + type ThisType[-U >: Untyped] <: Tree[U] + def withString(s: String): ThisType[String] = withString(s) + } + + class Ident[-T >: Untyped] extends Tree[T] { + type ThisType[-U] = Ident[U] + } + + val id = new Ident[Integer] + + val y = id.withString("abc") + + val z: Ident[String] = y + + val zz: tpd.Tree = y + + abstract class Instance[T >: Untyped] { + type Tree = higherKinded.Tree[T] + } + + object tpd extends Instance[String] + + def transform(tree: Tree[String]) = { + val tree1 = tree.withString("") + tree1: Tree[String] + } + +} |