I have a file that defines a trait and its companion object.
trait SomeTrait {
}
object SomeTrait extends SomeConfig {
implicit def intToString(v: Int): String = v.toString
}
In another file, I have a case class that extends a trait along with the one above.
case class SomeCaseClass extends AnotherTrait with SomeTrait {
protected def someLoginc(): Unit = {
// The compiler cannot find the implicit def intToString
}
}
How come the compiler cannot find the implicit defined in the companion object?
As per my understanding, the implicits defined in a companion object are automatically brought into the scope.