Skip to content

Commit 2073550

Browse files
committed
Address review comments
[Cherry-picked 32723c5][modified]
1 parent 8274988 commit 2073550

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ object Parsers {
15281528
def typ(): Tree =
15291529
val start = in.offset
15301530
var imods = Modifiers()
1531-
var erasedArgs: ListBuffer[Boolean] = ListBuffer()
1531+
val erasedArgs: ListBuffer[Boolean] = ListBuffer()
15321532

15331533
def functionRest(params: List[Tree]): Tree =
15341534
val paramSpan = Span(start, in.lastOffset)
@@ -3281,7 +3281,7 @@ object Parsers {
32813281
/** ClsTermParamClause ::= ‘(’ ClsParams ‘)’ | UsingClsTermParamClause
32823282
* UsingClsTermParamClause::= ‘(’ ‘using’ [‘erased’] (ClsParams | ContextTypes) ‘)’
32833283
* ClsParams ::= ClsParam {‘,’ ClsParam}
3284-
* ClsParam ::= {Annotation}
3284+
* ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’)] Param
32853285
*
32863286
* TypelessClause ::= DefTermParamClause
32873287
* | UsingParamClause

docs/_docs/internals/syntax.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ FunArgType ::= Type
210210
| ‘=>’ Type PrefixOp(=>, t)
211211
FunArgTypes ::= FunArgType { ‘,’ FunArgType }
212212
ParamType ::= [‘=>’] ParamValueType
213-
ParamValueType ::= IntoType [‘*’] PostfixOp(t, "*")
213+
ParamValueType ::= Type [‘*’] PostfixOp(t, "*")
214214
TypeArgs ::= ‘[’ Types ‘]’ ts
215-
Refinement ::= :<<< [RefineDef] {semi [RefineDcl]} >>> ds
215+
Refinement ::= :<<< [RefineDcl] {semi [RefineDcl]} >>> ds
216216
TypeBounds ::= [‘>:’ Type] [‘<:’ Type] TypeBoundsTree(lo, hi)
217217
TypeParamBounds ::= TypeBounds {‘:’ Type} ContextBounds(typeBounds, tps)
218218
Types ::= Type {‘,’ Type}
@@ -299,7 +299,7 @@ BlockStat ::= Import
299299
| Expr1
300300
| EndMarker
301301
TypeBlock ::= {TypeBlockStat semi} Type
302-
TypeBlockStat ::= ‘type’ {nl} TypeDcl
302+
TypeBlockStat ::= ‘type’ {nl} TypeDef
303303
304304
ForExpr ::= ‘for’ ‘(’ Enumerators0 ‘)’ {nl} [‘do‘ | ‘yield’] Expr ForYield(enums, expr) / ForDo(enums, expr)
305305
| ‘for’ ‘{’ Enumerators0 ‘}’ {nl} [‘do‘ | ‘yield’] Expr
@@ -359,7 +359,7 @@ ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
359359
| [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) ‘)’
360360
ClsParams ::= ClsParam {‘,’ ClsParam}
361361
ClsParam ::= {Annotation} ValDef(mods, id, tpe, expr) -- point of mods on val/var
362-
[{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
362+
[{Modifier} (‘val’ | ‘var’)] Param
363363
364364
DefParamClauses ::= DefParamClause { DefParamClause } -- and two DefTypeParamClause cannot be adjacent
365365
DefParamClause ::= DefTypeParamClause
@@ -473,7 +473,6 @@ TemplateBody ::= :<<< [SelfType] TemplateStat {semi TemplateStat} >>>
473473
TemplateStat ::= Import
474474
| Export
475475
| {Annotation [nl]} {Modifier} Def
476-
| {Annotation [nl]} {Modifier} Dcl
477476
| Extension
478477
| Expr1
479478
| EndMarker

docs/_docs/reference/syntax.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,12 @@ ClsParamClauses ::= {ClsParamClause} [[nl] ‘(’ [‘implicit’] ClsParams
348348
ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
349349
| [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) ‘)’
350350
ClsParams ::= ClsParam {‘,’ ClsParam}
351-
ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
351+
ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’)] Param
352352
353+
DefParamClauses ::= DefParamClause { DefParamClause } -- and two DefTypeParamClause cannot be adjacent
354+
DefParamClause ::= DefTypeParamClause
355+
| DefTermParamClause
356+
| UsingParamClause
353357
TypelessClauses ::= TypelessClause {TypelessClause}
354358
TypelessClause ::= DefTermParamClause
355359
| UsingParamClause
@@ -416,7 +420,7 @@ DefDcl ::= DefSig ‘:’ Type
416420
Def ::= ‘val’ PatDef
417421
| ‘var’ PatDef
418422
| ‘def’ DefDef
419-
| ‘type’ {nl} TypeDcl
423+
| ‘type’ {nl} TypeDef
420424
| TmplDef
421425
PatDef ::= ids [‘:’ Type] [‘=’ Expr]
422426
| Pattern2 [‘:’ Type] [‘=’ Expr] PatDef(_, pats, tpe?, expr)
@@ -456,7 +460,6 @@ TemplateBody ::= :<<< [SelfType] TemplateStat {semi TemplateStat} >>>
456460
TemplateStat ::= Import
457461
| Export
458462
| {Annotation [nl]} {Modifier} Def
459-
| {Annotation [nl]} {Modifier} Dcl
460463
| Extension
461464
| Expr1
462465
| EndMarker

0 commit comments

Comments
 (0)