Aladdin - Scala Bugtracking
[#517] project: nsc priority: low category: bug
submitter assigned to status date submitted
Gilles Martin won't fix 2006-01-18 15:28:29.0
subject Semicolon-less syntax does not work in for comprehension
code
object Test extends Application {
  for (val x <- List(1,2,3)
       val y <- List(4,5,6))
    Console.println(x*y)
}
what happened
error: ')' expected but 'val' found.
  for (val x <- List(1,2,3)
                           ^
what expected No error: just after List(1,2,3) seems to be a place where the rules for auto-addition of a semicolon should apply.
[back to overview]
Changes of this bug report
Gilles  edited on  2006-01-18 18:27:06.0

This won't be fixed as it apparently complicates the parsing quite a bit.

However, by using braces for the 'for' generators, it works without semicolons:

object Test extends Application {
  for {
    val x <- List(1,2,3)
    val y <- List(4,5,6)
  } Console.println(x*y)
}