When I try to compile the following code:
case class A(str: String)
case class B[T <: A](t: T)
def f[T <: A, X <: B[T]](x: X) = {}
f(B(A("str")))
I get the following error:
inferred type arguments [Nothing,B[A]] do not conform to method f's type parameter bounds [T <: A,X <: B[T]]
Why can the compiler not infer that T is of type A?