Is there a way to stop two traits from being mixed into a class together?
I know you can use self type annotations to require that a trait only be mixed into a class of a specific type, but can you use a similar construct to require that the target class NOT mix in a specific trait?
For example:
abstract class Collector(p: Boolean)
trait Cache
trait ACache extends Cache { self: Collector => }
trait BCache extends Cache { self: Collector => }
Can I require that any implementation of Collector mix in ACache, BCache, or no cache trait whatsoever, but not ACache and BCache simultaneously?
class GoodCollector(p: Boolean) extends Collector(p) with ACache //legal
class BadCollector(p: Boolean) extends Collector(p) with ACache with BCache //illegal