Skip to content

Commit 32723c5

Browse files
committed
Address review comments
1 parent 6159045 commit 32723c5

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

Diff for: compiler/src/dotty/tools/dotc/parsing/Parsers.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ object Parsers {
15391539
def typ(): Tree =
15401540
val start = in.offset
15411541
var imods = Modifiers()
1542-
var erasedArgs: ListBuffer[Boolean] = ListBuffer()
1542+
val erasedArgs: ListBuffer[Boolean] = ListBuffer()
15431543

15441544
def functionRest(params: List[Tree]): Tree =
15451545
val paramSpan = Span(start, in.lastOffset)
@@ -3324,7 +3324,7 @@ object Parsers {
33243324
/** ClsTermParamClause ::= ‘(’ ClsParams ‘)’ | UsingClsTermParamClause
33253325
* UsingClsTermParamClause::= ‘(’ ‘using’ [‘erased’] (ClsParams | ContextTypes) ‘)’
33263326
* ClsParams ::= ClsParam {‘,’ ClsParam}
3327-
* ClsParam ::= {Annotation}
3327+
* ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’)] Param
33283328
*
33293329
* TypelessClause ::= DefTermParamClause
33303330
* | UsingParamClause

Diff for: docs/_docs/internals/syntax.md

+4-5
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

Diff for: docs/_docs/reference/syntax.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ BlockStat ::= Import
294294
| Expr1
295295
| EndMarker
296296
TypeBlock ::= {TypeBlockStat semi} Type
297-
TypeBlockStat ::= ‘type’ {nl} TypeDcl
297+
TypeBlockStat ::= ‘type’ {nl} TypeDef
298298
299299
ForExpr ::= ‘for’ ‘(’ Enumerators0 ‘)’ {nl} [‘do‘ | ‘yield’] Expr
300300
| ‘for’ ‘{’ Enumerators0 ‘}’ {nl} [‘do‘ | ‘yield’] Expr
@@ -350,8 +350,12 @@ ClsParamClauses ::= {ClsParamClause} [[nl] ‘(’ [‘implicit’] ClsParams
350350
ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
351351
| [nl] ‘(’ ‘using’ (ClsParams | FunArgTypes) ‘)’
352352
ClsParams ::= ClsParam {‘,’ ClsParam}
353-
ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’) | ‘inline’] Param
353+
ClsParam ::= {Annotation} [{Modifier} (‘val’ | ‘var’)] Param
354354
355+
DefParamClauses ::= DefParamClause { DefParamClause } -- and two DefTypeParamClause cannot be adjacent
356+
DefParamClause ::= DefTypeParamClause
357+
| DefTermParamClause
358+
| UsingParamClause
355359
TypelessClauses ::= TypelessClause {TypelessClause}
356360
TypelessClause ::= DefTermParamClause
357361
| UsingParamClause
@@ -418,7 +422,7 @@ DefDcl ::= DefSig ‘:’ Type
418422
Def ::= ‘val’ PatDef
419423
| ‘var’ PatDef
420424
| ‘def’ DefDef
421-
| ‘type’ {nl} TypeDcl
425+
| ‘type’ {nl} TypeDef
422426
| TmplDef
423427
PatDef ::= ids [‘:’ Type] [‘=’ Expr]
424428
| Pattern2 [‘:’ Type] [‘=’ Expr] PatDef(_, pats, tpe?, expr)
@@ -458,7 +462,6 @@ TemplateBody ::= :<<< [SelfType] TemplateStat {semi TemplateStat} >>>
458462
TemplateStat ::= Import
459463
| Export
460464
| {Annotation [nl]} {Modifier} Def
461-
| {Annotation [nl]} {Modifier} Dcl
462465
| Extension
463466
| Expr1
464467
| EndMarker

0 commit comments

Comments
 (0)