Skip to content

Commit 8a872b6

Browse files
committed
Allow multiple newlines between annotations and defs
1 parent 39cafa7 commit 8a872b6

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2804,7 +2804,7 @@ object Parsers {
28042804
}
28052805

28062806
def annotations(skipNewLines: Boolean = false): List[Tree] = {
2807-
if (skipNewLines) newLineOptWhenFollowedBy(AT)
2807+
if (skipNewLines) newLinesOptWhenFollowedBy(AT)
28082808
if (in.token == AT) annot() :: annotations(skipNewLines)
28092809
else Nil
28102810
}

docs/docs/internals/syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ ExprInParens ::= PostfixExpr ‘:’ Type
234234
ParArgumentExprs ::= ‘(’ [‘using’] ExprsInParens ‘)’ exprs
235235
| ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘:’ ‘_’ ‘*’ ‘)’ exprs :+ Typed(expr, Ident(wildcardStar))
236236
ArgumentExprs ::= ParArgumentExprs
237-
| [nl] BlockExpr
237+
| BlockExpr
238238
BlockExpr ::= ‘{’ (CaseClauses | Block) ‘}’
239239
Block ::= {BlockStat semi} [BlockResult] Block(stats, expr?)
240240
BlockStat ::= Import
241-
| {Annotation [nl]} [‘implicit’ | ‘lazy’] Def
242-
| {Annotation [nl]} {LocalModifier} TmplDef
241+
| {Annotation {nl}} [‘implicit’ | ‘lazy’] Def
242+
| {Annotation {nl}} {LocalModifier} TmplDef
243243
| Expr1
244244
245245
ForExpr ::= ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’) ForYield(enums, expr)
@@ -358,7 +358,7 @@ ValDcl ::= ids ‘:’ Type
358358
VarDcl ::= ids ‘:’ Type PatDef(_, ids, tpe, EmptyTree)
359359
DefDcl ::= DefSig ‘:’ Type DefDef(_, name, tparams, vparamss, tpe, EmptyTree)
360360
DefSig ::= id [DefTypeParamClause] DefParamClauses
361-
| ExtParamClause [nl] [‘.’] id DefParamClauses
361+
| ExtParamClause {nl} [‘.’] id DefParamClauses
362362
TypeDcl ::= id [TypeParamClause] SubtypeBounds [‘=’ Type] TypeDefTree(_, name, tparams, bound
363363
364364
Def ::= ‘val’ PatDef

0 commit comments

Comments
 (0)