Skip to content

Commit d3a26e2

Browse files
authored
Merge pull request #11215 from unkarjedy/patch-3
syntax.md: support multiple if-guards on same line
2 parents a62acc8 + 294351a commit d3a26e2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,7 @@ object Parsers {
24782478
else Nil
24792479

24802480
/** Enumerator ::= Generator
2481-
* | Guard
2481+
* | Guard {Guard}
24822482
* | Pattern1 `=' Expr
24832483
*/
24842484
def enumerator(): Tree =

docs/docs/internals/syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ ForExpr ::= ‘for’ ‘(’ Enumerators0 ‘)’ {nl} [‘do‘ |
280280
Enumerators0 ::= {nl} Enumerators [semi]
281281
Enumerators ::= Generator {semi Enumerator | Guard}
282282
Enumerator ::= Generator
283-
| Guard
283+
| Guard {Guard}
284284
| Pattern1 ‘=’ Expr GenAlias(pat, expr)
285-
Generator ::= [‘case’] Pattern1 ‘<-’ Expr GenFrom(pat, expr)
285+
Generator ::= [‘case’] Pattern1 ‘<-’ Expr GenFrom(pat, expr)
286286
Guard ::= ‘if’ PostfixExpr
287287
288288
CaseClauses ::= CaseClause { CaseClause } Match(EmptyTree, cases)

docs/docs/reference/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ ForExpr ::= ‘for’ ‘(’ Enumerators0 ‘)’ {nl} [‘do‘ |
273273
Enumerators0 ::= {nl} Enumerators [semi]
274274
Enumerators ::= Generator {semi Enumerator | Guard}
275275
Enumerator ::= Generator
276-
| Guard
276+
| Guard {Guard}
277277
| Pattern1 ‘=’ Expr
278278
Generator ::= [‘case’] Pattern1 ‘<-’ Expr
279279
Guard ::= ‘if’ PostfixExpr

0 commit comments

Comments
 (0)