In the following example, I can’t get to hide update from public exposure:
trait Order {
sealed trait EntryOption {
private[Order] def update(e: EntryOption): Unit
}
private case object EmptyEntry extends EntryOption {
def update(e: EntryOption) = ()
}
trait Entry extends EntryOption
def test(a: Entry, b: EntryOption): Unit = a.update(b)
}
It fails to compile with "error: object creation impossible, since method $line12$$read$Order$^date in trait EntryOption of type (e: Order.this.EntryOption)Unit is not defined” – whatever that is supposed to be (compiler bug?). I tried the following without success:
- Also make
updateinEmptyEntryprivate[Order] - Make it
protected– this breaks methodtest
The goal is to have EntryOption‘s update inaccessible from outside Order.
EDIT
If I tentatively change trait Order to object Order it compiles, indicating a potential compiler bug?
A stupid work-around:
Should I file a bug?