aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/i1240a.scala
blob: dc711454e0a648bdb6f4f01323090c1ec4298616 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// more complicated example
abstract class A {
  type C[X]
  def foo[B](x: C[B]): C[B]       = {println("A.C"); x}
  def foo[B](x: List[B]): List[B] = {println("A.List"); x}
  def give[X]: C[X]
}

class B extends A {
  type C[X] = List[X]
  override def give[X] = Nil
  override def foo[B](x: C[B]): C[B] =  {println("B.C"); x} // error: merge error during erasure
  val a: A = this
  a.foo(a.give[Int]) // what method should be called here in runtime?
}