Aladdin - Scala Bugtracking
[#993] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Iulian fixed 2007-03-12 09:32:46.0
subject [contrib #370] compiler crash on bad code
code
object X {
    true | (throw new RuntimeException)
}
what happened
Compiler crashes:

Exception in thread "main" java.lang.Error: Uncomparbale type kinds: BOOL with
        at scala.tools.nsc.Global.abort(Global.scala:147)
        at scala.tools.nsc.backend.icode.TypeKinds$BOOL$.maxType(TypeKinds.sca
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.maxType$0(GenICod
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$27.apply
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$27.apply
        at scala.List.foldLeft(List.scala:913)
        at scala.List.reduceLeft(List.scala:941)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.getMaxType(GenICo
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genArithmeticOp$0
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bPhase$$genLoad(GenICode.scala:707)\

        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bPhase$$genStat(GenICode.scala:182)\

        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(
        at scala.List.foreach(List.scala:702)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bPhase$$genLoad(GenICode.scala:878)\

        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(
        at scala.List.foreach(List.scala:702)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(
        at scala.List.foreach(List.scala:702)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scal
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.sc
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:231)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:22
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:22
        at scala.Iterator$class.foreach(Iterator.scala:380)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scal
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:220)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scal
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:488)
        at scala.tools.nsc.Global$Run.compile(Global.scala:559)
        at scala.tools.nsc.Main$.process(Main.scala:57)
        at scala.tools.nsc.Main$.main(Main.scala:79)
        at scala.tools.nsc.Main.main(Main.scala)

what expected Some compile error
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-12 09:33:37.0
contribution #370
Iulian  edited on  2007-03-12 11:46:14.0
Fixed the crash. I guess the original poster wanted to use the shortcutting or, that is 'true || (throw..)'. The current example evaluates both branches eagarly, and always throws.
Iulian  edited on  2007-03-13 10:04:01.0