trait Base {
def someMethod: Unit
}
trait SomeTrait extends Base {
abstract override def someMethod: Unit = ???
}
class SomeTraitImp extends SomeTrait with Base {
override def someMethod: Unit = ???
}
Error message states:
Error: overriding method someMethod in trait SomeTrait of type => Unit; method someMethod needs `abstract override' modifiers override def someMethod: Unit = ???
Why Scala compiler restricts me from overriding this method without marking it as an abstract?
Edit:
I checked this answer and it explains why abstract
keyword required on method when we reference to super
which may not have implementation yet.
In my case I'm just trying to override someMethod
in SomeTrait
by brand new implementation and not trying to call super.someMethod
.
Is this override can break something at runtime?