In order to put the implicits in the places where they are required, the compiler first has to find them. This process is called implicit scope resolution and has well-defined rules in order to guarantee that implicits are determined as expected by the language specification and the developer using them. Implicit scope resolution is a three-step process.
Or four-step, if we count the case where the implicit parameter is provided explicitly as an argument to the method. We'll consider this case as number zero and won't take it into the account because it has the highest precedence and does not involve implicit lookup.
We'll provide a short overview of these steps so that we have them in one place for easy reference and then go into the details of each on the list:
- The current invocation (or lexical) scope. It has precedence over the implicit...