Aladdin - Scala Bugtracking
[#606] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Iulian fixed 2006-05-18 17:54:17.0
subject [contrib #130] vals inside finally blocks crash the compiler
code
object Test
{
        def main(argv : Array[String]) : Unit = {
                try {
                        ()
                } finally {
                        val x = null
                        ()
                }
        }
}
what happened
Exception in thread "main" java.lang.Error: assertion failed: Invalid index for: value x
        at scala.Predef$.assert(Predef.scala:171)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.indexOf(GenJVM.scala:921)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$27.apply(GenJVM.scala:494)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$27.apply(GenJVM.scala:431)
        at scala.Iterator$class.foreach(Iterator.scala:285)
        at scala.runtime.BoxedArray$$anon$0.foreach(BoxedArray.scala:32)
        at scala.Iterable$class.foreach(Iterable.scala:91)
        at scala.runtime.BoxedArray.foreach(BoxedArray.scala:14)
        at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.traverse(BasicBlocks.scala:67)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlock(GenJVM.scala:431)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlocks(GenJVM.scala:357)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlocks(GenJVM.scala:357)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genCode(GenJVM.scala:346)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genMethod(GenJVM.scala:249)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$11.apply(GenJVM.scala:168)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$11.apply(GenJVM.scala:168)
        at scala.List.foreach(List.scala:681)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genClass(GenJVM.scala:168)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$0.apply(GenJVM.scala:41)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$0.apply(GenJVM.scala:41)
        at scala.Iterator$class.foreach(Iterator.scala:285)
        at scala.collection.Map$$anon$1.foreach(Map.scala:95)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase.run(GenJVM.scala:41)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:432)
        at scala.tools.nsc.Global$Run.compile(Global.scala:490)
        at scala.tools.nsc.Main$.process(Main.scala:60)
        at scala.tools.nsc.Main$.main(Main.scala:82)
        at scala.tools.nsc.Main.main(Main.scala)
what expected No crash.
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-05-18 17:54:47.0
Iulian  edited on  2006-05-19 16:58:06.0