Aladdin - Scala Bugtracking
[#321] project: specification priority: medium category: bug
submitter assigned to status date submitted
Matthias Martin fixed 2004-04-26 12:41:23.0
subject Overriding methods with contravariant parameter types
code
class A {
  def foo(x: B) = "A.foo";
}
class B extends A {
  override def foo(x: A) = "B.foo";
}
what happened
Compiler yields:
S.scala:5: method foo overrides nothing
  override def foo(x: A) = "B.foo";
               ^
one error found
what expected The spec says that method conformance is contra/covariant. It seems like the compiler wants invariant parameter types.
[back to overview]
Changes of this bug report
Matthias  edited on  2004-04-26 12:42:02.0
Martin  edited on  2004-07-01 15:39:58.0
Spec is changed to mandate invariant parameters for overriding