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 {
1665
1665
def condExpr (altToken : Token ): Tree =
1666
1666
if in.token == LPAREN then
1667
1667
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
1670
1670
t = inSepRegion(LBRACE , RBRACE ) {
1671
1671
expr1Rest(postfixExprRest(simpleExprRest(t)), Location .ElseWhere )
1672
1672
}
1673
1673
if in.token == altToken then
1674
1674
if rewriteToOldSyntax() then revertToParens(t)
1675
1675
in.nextToken()
1676
1676
else
1677
- if (altToken == THEN || ! newSyntax ) && in.isNewLine then
1677
+ if (altToken == THEN || enclosedInParens ) && in.isNewLine then
1678
1678
in.observeIndented()
1679
- if newSyntax && in.token != INDENT then accept(altToken)
1679
+ if ! enclosedInParens && in.token != INDENT then accept(altToken)
1680
1680
if (rewriteToNewSyntax(t.span))
1681
1681
dropParensOrBraces(t.span.start, s " ${tokenString(altToken)}" )
1682
1682
t
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ layout: doc-page
3
3
title : New Control Syntax
4
4
---
5
5
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
7
7
enclosing the condition in parentheses, and also allows to drop parentheses or braces
8
8
around the generators of a ` for ` -expression. Examples:
9
9
``` scala
You can’t perform that action at this time.
0 commit comments