Aladdin - Scala Bugtracking
[#337] project: compiler priority: low category: bug
submitter assigned to status date submitted
Philippe Philippe fixed 2004-06-04 13:19:47.0
subject Erasure creates unexpected overrides
code
class A {
  def foo[X](x: X): Int = 1;
}

object Test extends A {
  def foo(x: Any): Int = 2;
  def main(args: Array[String]): Unit = {
    val a: A = this;
    System.out.println(a.foo(0));
  }
}
what happened
Prints 2 at runtime.
what expected The program should either print 1 or there should be an error because the two methods foo have different signatures but are erased to the same signature.
[back to overview]
Changes of this bug report
Philippe  edited on  2004-06-04 13:20:19.0
See also bug 336.
Martin  edited on  2004-07-02 18:48:03.0
My fix for bug 336 also solves this problem.