That was the first invocation, methodA(f2). Now, about that second one, methodB(f2). This is where things get a bit more interesting. What Scala compiler just performed for us is called eta-expansion. There are two directions for this “eta operation”, as you will see soon. In literature, direction of eta-expansion is also sometimes called eta-abstraction, opposite direction is called eta-reduction, and they are both referred to under common term eta-conversion.
The idea behind eta-expansion is pretty simple. Having a function f(x), we normally refer to the function itself as f. For example, imagine we need to pass it to another function; we would pass simply f. Now, if instead of passing f we passed x ⇒ f(x), nothing would change, would it? Take the square function for example. We give it a 4, it returns a 16. Having this function is completely the same as having function x ⇒ sqr(x). We give it a 4, it returns a 16. We just “wrapped” our sqr function with another layer, resulting in another function. We can do this indefinitely: