以下是错误还是故意?
trait Dyn {
val D1 = new Dynamic {
def applyDynamic(name: String)(args: Any*) = "Hi"
}
object D2 extends Dynamic {
def applyDynamic(name: String)(args: Any*) = "Hey"
}
}
trait T { self: Dyn =>
def foo1 = D1.X
def foo2 = D2.X
}
object T extends T with Dyn
object Dyn extends Dyn
T.D1.X // works
Dyn.D1.X // works
T.foo1 // doesn't work: java.lang.NoSuchFieldError: reflPoly$Cache1
T.D2.X // works
Dyn.D2.X // works
T.foo2 // works