bug
bug copied to clipboard
Implicit search does not guide type inference to find a supertype
trait R[T]
case class A(i: Int)
object A {
implicit object RA extends R[A]
}
class B(i: Int) extends A(i)
def foo[T, TT >: T](x : T)(implicit ev: R[TT]) = 0
println(foo(new B(1))) // infers T and TT as B and fails to find implicit R[B]
It seems that TT is inferred before getting to the implicit parameter block in spite of not being mentioned in the first parameter block.
Related SO question: http://stackoverflow.com/questions/28509637/implicit-search-does-not-guide-type-inference-to-find-a-supertype-in-scala
Imported From: https://issues.scala-lang.org/browse/SI-9169?orig=1 Reporter: Jonathan Chayat (jchayat) Affected Versions: 2.10.4, 2.11.5