Aladdin - Scala Bugtracking
[#118] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Martin fixed 2003-09-10 13:55:57.0
subject Return allowed in constructors?
code
class C(y: Int) {
    def this() = {
    	return null;
    	this(1);
    }
}
what happened
Crash:
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 The compiler should disallow return expressions in constructors.
[back to overview]
Changes of this bug report
Martin  edited on  2003-09-10 15:52:28.0