Scala Compiler Implicit Parameter Precedence
The compiler doesn’t randomly look for implicits in your code; it follows the following precedence:
- Locally declared implicits
- Imported implicits
- Outer scope (ex- a class for a method)
- Inheritance
- Package object
- Implicit scope like companion objects
Source: Top 30 Scala Interview Questions