Following from this question, I have now the following:
case class Pet(val name: String)
trait ConfigComponent {
You can wrangle your self-type to keep the abstract type member you want, since the last bound wins:
trait PetStoreModuleImpl extends PetStoreModule {
self: VetModule with AnotherModule with PetStoreModuleImpl =>
override def petStore: PetStore = PetstoreImpl
object PetstoreImpl extends PetStore {
def sell(pet: Pet) {
vet.vaccinate(pet)
println(s"Sold $pet! [Store: ${config.petStoreName}, lastName: $getLastName]")
}
}
}
Then it will tell you that the vet module isn't configured:
class MyApp extends PetStoreModuleImpl with VetModuleImpl with AnotherModuleImpl {
override type Config = PetStoreConfig with VetModuleConfig with AnotherConfig
override object config extends PetStoreConfig with VetModuleConfig with AnotherConfig {
val petStoreName = "MyPetStore"
val lastName = "MyLastName"
val extra = "vet-info"
}
petStore.sell(new Pet("Fido"))
}