This compiles fine:
def walk[X](a: X)(f: X => Boolean): Boolean = f(a)
walk(1)(_ => true)
This compiles fine as well:
def walk(a: Int)(f: Int => Boolean = _ => true): Boolean = f(a)
walk(1)()
This does not:
def walk[X](a: X)(f: X => Boolean = _ => true): Boolean = f(a)
walk(1)()
The error is:
Error:(1, 38) missing parameter type
The obvious workaround is to use (_: X) => true, but why is this an error? I though that when the second parameter list is being processed, type information obtained from the first one should already be available?
Tested with Scala 2.11.8 and 2.12.1