Aladdin - Scala Bugtracking
[#411] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Michel Martin fixed 2005-04-01 09:34:25.0
subject Unnoticed overriding when using compound types
code
class C;
class D;

class C1 {
  def f(x: C with D): Unit = ();
}

class C2 extends C1 {
  override def f(x: D with C): Unit = ()
}
what happened
The compiler complains with:
test-bridge.scala:9: method f:(D with C )scala.Unit in class C2 overrides nothing
  override def f(x: D with C): Unit = ()
               ^
one error found
what expected

No error message. It is my understanding that compound types are real intersection types, and therefore the order of the components shouldn't matter. If this isn't the case, please consider this report as a request to clarify the equivalence of compound types in the reference (ยง3.5.1).

[back to overview]
Changes of this bug report
Martin  edited on  2006-03-30 18:11:22.0
Compound types are currently not real intersection types. I clarified the spec to be more explicit about this: Two compound types are equivalent if the sequences of their component are pairwise equivalent, and occur in the same order, and their refinements are equivalent.