Aladdin - Scala Bugtracking
[#175] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Michel Michel fixed 2003-10-03 11:38:25.0
subject cannot define secondary constructors in abstract classes
code
abstract class C {
  def this(x: Unit) = { this() }
}
what happened
The compiler complains with the following error message:
bug_sec_cons.scala:1: `abstract' modifier can be used only for classes;
it should be omitted for abstract members
abstract class C {
               ^
one error found
which is clearly wrong since the abstract modifier is applied only to the class. This happens only \ in the presence of secondary constructors in abstract classes, and my guess is that the modifiers of the class a\ re simply copied to the constructor.
what expected no errors
[back to overview]
Changes of this bug report
Martin  edited on  2003-10-08 16:55:00.0
I changed the code which copies the modifiers. The program now compiles, but generates a backend crash:
xception in thread "main" java.lang.AssertionError: void -> java.lang.Object
	at scalac.backend.jvm.GenJVM.genWidenConversion(GenJVM.java:927)
	at scalac.backend.jvm.GenJVM.genLoad(GenJVM.java:559)
	at scalac.backend.jvm.GenJVM.genLoad(GenJVM.java:228)
	at scalac.backend.jvm.GenJVM.genLoadQualifier(GenJVM.java:593)
	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)
Philippe  edited on  2003-10-15 15:10:47.0

The problem raised after Martin's change is the same as the one that caused bug 160. It is fixed, now.