Skip to content

Commit 7899462

Browse files
authored
Merge pull request #13079 from dotty-staging/fix-13027
Fix syntax of extension methods
2 parents b61eb2e + 2160209 commit 7899462

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3627,7 +3627,7 @@ object Parsers {
36273627
finalizeDef(gdef, mods1, start)
36283628
}
36293629

3630-
/** Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
3630+
/** Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause} ‘(’ DefParam ‘)’
36313631
* {UsingParamClause} ExtMethods
36323632
*/
36333633
def extension(): ExtMethods =

docs/docs/internals/syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ EnumDef ::= id ClassConstr InheritClauses EnumBody
414414
GivenDef ::= [GivenSig] (AnnotType [‘=’ Expr] | StructuralInstance)
415415
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefParamClause`, `UsingParamClause` must be present
416416
StructuralInstance ::= ConstrApp {‘with’ ConstrApp} [‘with’ TemplateBody]
417-
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
418-
{UsingParamClause} ExtMethods
417+
Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause}
418+
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods
419419
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
420420
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
421421
Template ::= InheritClauses [TemplateBody]

docs/docs/reference/contextual/extension-methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ to the [current syntax](../syntax.md).
288288
BlockStat ::= ... | Extension
289289
TemplateStat ::= ... | Extension
290290
TopStat ::= ... | Extension
291-
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
292-
{UsingParamClause} ExtMethods
291+
Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause}
292+
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods
293293
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
294294
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
295295
```

docs/docs/reference/syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ EnumDef ::= id ClassConstr InheritClauses EnumBody
400400
GivenDef ::= [GivenSig] (AnnotType [‘=’ Expr] | StructuralInstance)
401401
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefParamClause`, `UsingParamClause` must be present
402402
StructuralInstance ::= ConstrApp {‘with’ ConstrApp} [‘with’ TemplateBody]
403-
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
404-
{UsingParamClause} ExtMethods
403+
Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause}
404+
‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods
405405
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
406406
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
407407
Template ::= InheritClauses [TemplateBody]

0 commit comments

Comments
 (0)