Closed
Description
Minimized code
trait X {
trait S
}
class Xa(val internal: X) {
type S = internal.S
def s: S = new S{}
implicit class XS(s: S) {
def printX: Unit = println(s)
}
}
object Xa extends Xa(new X{})
object App extends App {
Xa.s.printX
}
Output
Xa$$anon$1@55924a6a
The above, unexpectedly, compiles and works with Dotty[1], but not with Scala 2.13[2]
Expectation
It seems like Xa
is included in the implicit scope of type Xa.internal.S
where Xa
is not a direct prefix of S
, but is instead only a prefix of its prefix, whereas Scala 2 does not include prefixes of prefixes in implicit scope, but only non-prefix parts of the direct prefix.