You have come across the heuristics used by the compiler to avoid exponentially complex type searches. When a method is overloaded, it tries to disambiguate depending on the type of argument. Unfortunately, the argument is also overloaded. Instead of trying out the possibilities, it just captures the first that comes to mind and it doesn't work.
You can trick him into looking for more by setting the correct path:
g(math.max(_,_))
Itβs now justified to the compiler that he is looking for Function2 and that - although all versions of max must be Function2 ! - enough to get the compiler to do a matching search (and it matches Double with Double ).
source share