Aladdin - Scala Bugtracking
[#408] project: compiler priority: high category: bug
submitter assigned to status date submitted
Michel Martin fixed 2005-03-14 08:37:40.0
subject LambdaLift lifts functions to the top level
code
class C(x: Int);
class D extends C({ def f(): Int = 1; f() });
what happened
After LambdaLift, function f is lifted to the top level:
class C(x: scala.Int) extends java.lang.Object() with scala.ScalaObject() {
  override def $tag(): scala.Int = 0;
  override def getType(): scala.runtime.types.ScalaClassType = null
};
class D() extends C({
      f$0()
    }) with scala.ScalaObject() {
  override def $tag(): scala.Int = 0;
  override def getType(): scala.runtime.types.ScalaClassType = null
};
final private def f$0(): scala.Int = 1;

what expected

No functions at the top level. It's not completely clear how to fix this bug, but one idea would be to promote f to a static function of class D. Static functions are more or less hacked into the compiler right now (I use them for run time types), but should IMHO be integrated into the design of the new compiler.

I've set the priority of this bug to high, I need a fix for run time types to work in all cases.

[back to overview]
Changes of this bug report
Martin  edited on  2006-03-30 18:17:38.0
Fixed in version 2