summaryrefslogtreecommitdiff
path: root/test/pending/pos/t5685b.scala
blob: 18ff803f89f437cd647a555686ebf2126303cf0e (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
trait X[+A] {
  def x: A
}

trait XPrint[+A] extends X[A] {
  abstract override def x: A = {
    val a = super.x
    println(a)
    a
  }
}

trait F[-A, +B] { outer =>
  def apply(xv: X[A]): X[B]

  def andThen[C](f: F[B, C]): F[A, C] = new F[A, C] {
    def apply(xv: X[A]): X[C] = f(new XX(xv) with XPrint[B])
  }

  class XX(xv: X[A]) extends X[B] {
    def x = outer(xv).x
  }
}