Skip to content

Commit 4d470dd

Browse files
committed
Address review comments
1 parent 912c672 commit 4d470dd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

docs/docs/reference/other-new-features/control-syntax-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: doc-page
33
title: 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
77
enclosing the condition in parentheses, and also allows to drop parentheses or braces
88
around the generators of a `for`-expression. Examples:
99
```scala

0 commit comments

Comments
 (0)