Aladdin - Scala Bugtracking
[#943] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin noise 2007-02-11 17:27:37.0
subject [contrib #325] object inheritance name conflict
code
trait X { def x = 1 }
trait Y { def x = 2 }
object Z extends X with Y
what happened
test4.scala:3: error: error overriding method x in trait X of type => scala.Int;
 method x in trait Y of type => scala.Int needs `override' modifier
object Z extends X with Y
^
one error found

Addition of 'override' in trait Y is futile.
what expected Silent compilation
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-02-11 17:29:20.0
contribution #325
Martin  edited on  2007-03-05 23:43:07.0
This is required behavior, to prevent accidental overrides. The override needs to be resolved by hand, as in:
object Z extends X with Y {
  override def x = super.x
}