summaryrefslogtreecommitdiff
path: root/test/pending/pos/t5685.scala
blob: 9ac42a174e5baf1389f6f97c2ecaa68a19db6aec (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
  }
}