Using cake pattern we can set a member only accessible to directly inherited trait
trait A { val a = 1 }
trait B { this: A => val b = a + 1 } // can access a
trait C { this: B => val c = a + 1 } // will throw error because C cannot access a
I want to apply this member access logic using access modifier rather than self annotation
For example,
trait A { protected[B] val a = 1 }
trait B extends A { val b = a + 1 }
trait C extends B { val c = a + 1 } // I want this to throw an error
Any solution?