Skip to content

Commit

Permalink
Looks like there was a little baby in the parse...
Browse files Browse the repository at this point in the history
Looks like there was a little baby in the parser bathwater, or at least
some bathwater still in the general shape of a baby. Apparently both
old forms weren't deprecated. The spec does not suggest that the 'val'
in for comprehension assignment is optional, but clearly it can't go
anywhere for a while yet regardless. Will seek clarification. No review.
  • Loading branch information
paulp committed Aug 8, 2011
1 parent 9e4bdd4 commit cda4650
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,11 @@ self =>

if (hasVal && !hasEq)
syntaxError(in.offset, "val in for comprehension must be followed by assignment")
if (!hasVal && hasEq)
syntaxError(in.offset, "assignment in for comprehension must be preceded by `val`")
if (!hasVal && hasEq) {
deprecationWarning(in.lastOffset, "for comprehension assignment without a `val' declaration is deprecated.")
// not yet, deprecated in 2.10.0.
// syntaxError(in.offset, "assignment in for comprehension must be preceded by `val`")
}

if (hasEq && eqOK) in.nextToken()
else accept(LARROW)
Expand Down

0 comments on commit cda4650

Please sign in to comment.