Aladdin - Scala Bugtracking
[#116] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Philippe fixed 2003-09-10 12:26:28.0
subject Classes in constructors provoke type/boxing problems
code
class C {
  def this(x: Int) = {
    class D extends C;
    this();
  }
}
what happened
Crashes compiler:
Exception in thread "main" java.lang.AssertionError: void -> java.lang.Object
        at scalac.backend.jvm.GenJVM.genWidenConversion(GenJVM.java:914)
        at scalac.backend.jvm.GenJVM.genLoad(GenJVM.java:553)
        at scalac.backend.jvm.GenJVM.genLoad(GenJVM.java:228)
        at scalac.backend.jvm.GenJVM.genLoadQualifier(GenJVM.java:587)
        at scalac.backend.jvm.GenJVM.genLoad(GenJVM.java:249)
        at scalac.backend.jvm.GenJVM.gen(GenJVM.java:165)
        at scalac.backend.jvm.GenJVM.gen(GenJVM.java:199)
        at scalac.backend.jvm.GenJVM.gen(GenJVM.java:143)
        at scalac.backend.jvm.GenJVM.gen(GenJVM.java:138)
        at scalac.backend.jvm.GenJVM.translate(GenJVM.java:110)
        at scalac.backend.jvm.GenJVMPhase.apply(GenJVMPhase.java:45)
        at scalac.Global.compile(Global.java:293)
        at scalac.Global.compile(Global.java:266)
        at scalac.Main.main(Main.java:32)
what expected Compiles.
[back to overview]
Changes of this bug report
Matthias  edited on  2003-09-10 14:52:26.0
I just found out that it has actually nothing to do with the class in the non-primary constructor. You can put pretty much everything in there and it will yield the exception in the "what happened" field. For instance, a simple variable definition provokes already the exception:
  def this(x: Int) = {
    var y = x + x;
    this();
  }
Philippe  edited on  2003-10-15 15:06:42.0

Fixed computation of enclosing class in lambda lift.