File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
compiler/src/dotty/tools/dotc/parsing
docs/docs/reference/other-new-features Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1665,18 +1665,18 @@ object Parsers {
16651665 def condExpr (altToken : Token ): Tree =
16661666 if in.token == LPAREN then
16671667 var t : Tree = atSpan(in.offset) { Parens (inParens(exprInParens())) }
1668- val newSyntax = toBeContinued(altToken)
1669- if newSyntax then
1668+ val enclosedInParens = ! toBeContinued(altToken)
1669+ if ! enclosedInParens then
16701670 t = inSepRegion(LBRACE , RBRACE ) {
16711671 expr1Rest(postfixExprRest(simpleExprRest(t)), Location .ElseWhere )
16721672 }
16731673 if in.token == altToken then
16741674 if rewriteToOldSyntax() then revertToParens(t)
16751675 in.nextToken()
16761676 else
1677- if (altToken == THEN || ! newSyntax ) && in.isNewLine then
1677+ if (altToken == THEN || enclosedInParens ) && in.isNewLine then
16781678 in.observeIndented()
1679- if newSyntax && in.token != INDENT then accept(altToken)
1679+ if ! enclosedInParens && in.token != INDENT then accept(altToken)
16801680 if (rewriteToNewSyntax(t.span))
16811681 dropParensOrBraces(t.span.start, s " ${tokenString(altToken)}" )
16821682 t
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ layout: doc-page
33title : New Control Syntax
44---
55
6- Scala 3 has a new "quiet" syntax for control expressions that does not rely in
6+ Scala 3 has a new "quiet" syntax for control expressions that does not rely on
77enclosing the condition in parentheses, and also allows to drop parentheses or braces
88around the generators of a ` for ` -expression. Examples:
99``` scala
You can’t perform that action at this time.
0 commit comments