aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/pos/hk-named.scala
blob: 5f2cb6c742dd932e1e383d0f1f8e8fdbe042e5d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import language.higherKinds

object hk0 {

  trait Lambda[type Elem]

  abstract class Functor[F <: Lambda] {
    def map[A, B](f: A => B): F[Elem = A] => F[Elem = B]
  }

  object test1 {
    class ListT[T] extends Lambda[T]

    val ml: Functor[ListT] = ???
    val mx = ml
    var xs: ListT[Int] = ???
    var ys: ListT { type Elem = Int } = xs
    xs = ys
    val mm: (Int => Boolean) => ListT[Int] => ListT[Boolean] = mx.map[Int, Boolean]
    val mm2: (Int => Boolean) => ListT[Int] => ListT[Boolean] = mx.map
  }
}


object higherKinded {

  type Untyped = Null

  class Tree[type -Attr >: Untyped] {
    type ThisType <: Tree
    def withString(s: String): ThisType[Attr = String] = withString(s)
  }
/*
  class Ident[-Attr >: Untyped] extends Tree[Attr] {
    type ThisType = Ident
  }

  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] {g
    type Tree = higherKinded.Tree[T]
  }

  object tpd extends Instance[String]

  def transform(tree: Tree[String]) = {
    val tree1 = tree.withString("")
    tree1: Tree[String]
  }
*/
}