I'm wondering if this is a bug or an expected behaviour in Scala 2.13-M5.
Following snippet compiles and outputs "object in package object":
package object test {
implicit val a: TS = new TS("val in package object")
implicit object b extends TS("object in package object")
}
package test {
class TS(override val toString: String)
class Inner {
implicit val f: TS = new TS("val in inner class")
val resolve = implicitly[TS]
}
object Test extends App {
println(new Inner().resolve)
}
}
With commented out third line implicit object b extends TS("object in package object" there is an ambiguous implicit compile error which is what I would expect in first case as well:
Error:(11, 29) ambiguous implicit values:
both value a in package test of type => test.TS
and value f in class Inner of type => test.TS
match expected type test.TS
val resolve = implicitly[TS]