Aladdin - Scala Bugtracking
[#238] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Stephane Martin fixed 2003-11-26 18:20:51.0
subject AssertionError in Erasure.java
code
class Foo {
  def fun(i: Int): Int = 0;
}

object Bar {
  def foo = new Foo {
    def fun(): Int = 0;
  };
  foo.fun();
}
what happened
Exception in thread "main" java.lang.AssertionError: Bar#6.foo#7().fun#8
	at scalac.transformer.Erasure.transform(Erasure.java:207)
	at scalac.transformer.Erasure.transform(Erasure.java:177)
	at scalac.transformer.Erasure.transform(Erasure.java:255)
	at scalac.transformer.Erasure.transform(Erasure.java:127)
	at scalac.ast.GenTransformer.transform(Transformer.java:569)
	at scalac.transformer.Erasure.transform(Erasure.java:114)
	at scalac.ast.GenTransformer.transform(Transformer.java:569)
	at scalac.ast.GenTransformer.apply(Transformer.java:402)
	at scalac.transformer.Erasure.apply(Erasure.java:105)
	at scalac.ast.GenTransformer.apply(Transformer.java:396)
	at scalac.transformer.ErasurePhase.apply(ErasurePhase.java:52)
	at scalac.Global.compile(Global.java:300)
	at scalac.Global.compile(Global.java:272)
	at scala.tools.scalac.Main$.main(sources/scala/tools/scalac/Main.scala:33)
	at scala.tools.scalac.Main.main(sources/scala/tools/scalac/Main.scala)
what expected

The compiler should signal an error because there is no override flag in the anonymous class or because the fun method does not override Foo.fun.

[back to overview]
Changes of this bug report
Philippe  edited on  2003-11-27 16:13:09.0

Simplified example, updated what expected, reassigned to Martin.

Martin  edited on  2004-01-08 15:42:08.0