Sample code with two overload method compiles (Scala 2.11.8), as expected:
def foo(p: Int, t: Double): Unit = {}
def foo(r: Int => Double): Unit = {}
foo(0, 0) // 1st method
foo(x => x.toDouble) // 2nd method
Same code with generic parameter added:
def fooGeneric[T](p: T, t: Double): Unit = {}
def fooGeneric[T](r: T => Double): Unit = {}
fooGeneric[Int](1, 1) // 1st method
fooGeneric[Int]((x: Int) => x.toDouble) //2nd method
fooGeneric[Int](x => x.toDouble) // does not compile
yields the following compilation error:
Error:(112, 19) missing parameter type
fooGeneric[Int](x => x.toDouble)
There seems to be is no ambiguity in the method resolution, yet compiler fails to find the match. Why?