Open
Description
class Foo[T <: String]
class Bar[T]
def foo[T](implicit bar: Bar[T]) = bar
implicit def mkFooBar[A, T[x] <: Foo[x]]: Bar[T[A]] = new Bar[T[A]]
foo[Foo[String]]
If you compile this code in one go, you get the following error:
error: could not find implicit value for parameter bar: Bar[Foo[String]]
foo[Foo[String]]
^
This error is actually caused by another error:
error: type arguments [x] do not conform to class Foo's type parameter bounds [T <: String]
implicit def mkFooBar[A, T[x] <: Foo[x]]: Bar[T[A]] = new Bar[T[A]]
^
This is the error you actually have to fix to get the code working, but the compiler doesn't show it and leaves you guessing what the problem is.