Aladdin - Scala Bugtracking
[#1087] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Iulian fixed 2007-05-06 23:06:43.0
subject [contrib #455] combination of return in synchronize block and finally break compiler
code
object TestReturnInSynchronize {
  
  def foo : unit = {
    try {
      "test".synchronized {
        return
      }
    } finally {
      // nothing
    }
  }
  
}
what happened
boisvert@boog:~/prog/LoadBalancer.scala/src$ scalac TestReturnInSynchronize.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Illegal nesting of cleanup operations: Li\
st(MonitorRelease(variable monitor0),Finalizer(())) while exiting finalizer ()
        at scala.Predef$.assert(Predef.scala:89)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$Context.removeFinalizer(GenICode.scala:1781)
what expected compilation works or proper error reporting (i'm not sure return is allowed inside the synchronized)
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-05-06 23:10:50.0
contribution #455
Iulian  edited on  2007-05-07 10:53:02.0