Aladdin - Scala Bugtracking
[#323] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Philippe fixed 2004-04-30 16:27:30.0
subject Compiler crashes in Erasure
code
object IllegalBoolean2Float {
var myBool :boolean = true;
var myInt:int = 10;

def main(args: Array[String]): unit = {
	myInt = myBool.asInstanceOf[int];
 }
}
what happened
Exception in thread "main" scalac.ApplicationError: illegal case: 17 -> 13
        at scalac.util.Debug.abort(Debug.java:46)
        at scalac.backend.Primitives.getConvertSymbol(Primitives.java:1119)
        at scalac.backend.Primitives.getConvertSymbol(Primitives.java:1039)
        at scalac.backend.Primitives.getConvertSymbol(Primitives.java:1019)
        at scalac.transformer.Erasure.convert(Erasure.java:373)
        at scalac.transformer.Erasure.coerce(Erasure.java:323)
        at scalac.transformer.Erasure.transform(Erasure.java:167)
        at scalac.ast.GenTransformer.transform(Transformer.java:573)
        at scalac.transformer.Erasure.transform(Erasure.java:179)
        at scalac.transformer.Erasure.transform(Erasure.java:283)
        at scalac.transformer.Erasure.transform(Erasure.java:128)
        at scalac.ast.GenTransformer.transform(Transformer.java:578)
        at scalac.transformer.Erasure.transform(Erasure.java:115)
        at scalac.ast.GenTransformer.transform(Transformer.java:573)
        at scalac.ast.GenTransformer.apply(Transformer.java:406)
        at scalac.transformer.Erasure.apply(Erasure.java:106)
        at scalac.ast.GenTransformer.apply(Transformer.java:400)
        at scalac.transformer.ErasurePhase.apply(ErasurePhase.java:52)
        at scalac.Global.compile(Global.java:372)
        at scalac.Global.compile(Global.java:344)
        at scala.tools.scalac.Main$.main1(Main.scala:35)
        at scala.tools.scalac.Main$.main(Main.scala:27)
        at scala.tools.scalac.Main.main(Main.scala:27)
what expected Perhaps an error message but not a crash.
[back to overview]
Changes of this bug report
Erik  edited on  2004-04-30 16:27:54.0
Discovered by Urs.
Lex  edited on  2006-03-28 14:14:08.0
This now compiles and then throughs a ClassCastException at runtime. That is the correct behavior.