Aladdin - Scala Bugtracking
[#306] project: compiler priority: medium category: feature
submitter assigned to status date submitted
Burak _ fixed 2004-03-11 18:47:56.0
subject erroneous code-generation
code
object test with Application {
  def loop = {
    val it = List(1,2,3).elements;
    var res = true;
    while( it.hasNext ) {            // inefficient, but should be fine
      res = res && ( it.next == 2 );
    }
    res
  }
  Console.println( loop );
}
what happened
loops at execution.
what expected prints false.
[back to overview]
Changes of this bug report
Burak  edited on  2004-03-12 16:52:52.0
(oops) I am sorry, with shortcut evaluation, this will of course loop, whenever it.next != 2 && it.hasNext.

This is just a silly programming error in the end.