Scala lambda function not resolved when declares the type of parameter?

Viewed 140

when defining method in Scala, I found this

def method1: Int => Int = (j: Int) => j  // works
def method2: Int => Int = j => j  // works
def method3: Int => Int = j: Int => j  // error
def method4: Int => Int = {j: Int => j}  // works

Can anyone explain why method3 does not work? Is there any ambiguity in it?

2 Answers
Related