I can’t see why in the following code the import (import b._) that pulls in the implicit def must appear in both position 1 and position 2 for it to work.
package a {
abstract class Base {}
}
package b {
import a._
class Derived(i: Int) extends Base {}
object b {
implicit def i2d(i: Int): Derived = new Derived(i)
}
}
import a._
// position 1
import b._
object test extends App {
// position 2
import b._
def doIt(base: Base) {
println("works")
}
doIt(1)
}
At position 1 you are importing everything from the package b and at position 2 you are importing everything from the object b, which includes the implicit def. You could just
import b.b._at position 2.