Skip to content

Commit 62e18d7

Browse files
committed
Change syntax of ConstrApps
The previous syntax was unparseable without major contortions in the Parser.
1 parent a64f53f commit 62e18d7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

docs/docs/internals/syntax.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ Template ::= InheritClauses [TemplateBody]
386386
InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}]
387387
ConstrApps ::= ConstrApp {‘with’ ConstrApp}
388388
| ConstrApp {‘,’ ConstrApp}
389-
ConstrApp ::= AnnotType {ArgumentExprs} Apply(tp, args)
390-
| ‘(’ ConstrApp {‘given’ (InfixExpr | ParArgumentExprs)} ‘)’
389+
ConstrApp ::= SimpleConstrApp
390+
| ‘(’ SimpleConstrApp {‘given’ (PrefixExpr | ParArgumentExprs)} ‘)’
391+
SimpleConstrApp ::= AnnotType {ArgumentExprs} Apply(tp, args)
391392
ConstrExpr ::= SelfInvocation
392393
| ConstrBlock
393394
SelfInvocation ::= ‘this’ ArgumentExprs {ArgumentExprs}

docs/docs/reference/contextual-implicit/instance-defs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ TmplDef ::= ...
7575
InstanceDef ::= [id] [DefTypeParamClause] InstanceBody
7676
InstanceBody ::= [‘for’ ConstrApp {‘,’ ConstrApp }] {GivenParamClause} [TemplateBody]
7777
| ‘for’ Type {GivenParamClause} ‘=’ Expr
78-
ConstrApp ::= AnnotType {ArgumentExprs}
79-
| ‘(’ ConstrApp {‘given’ (InfixExpr | ParArgumentExprs)} ‘)’
78+
ConstrApp ::= SimpleConstrApp
79+
| ‘(’ SimpleConstrApp {‘given’ (PrefixExpr | ParArgumentExprs)} ‘)’
80+
SimpleConstrApp ::= AnnotType {ArgumentExprs}
8081
GivenParamClause ::= ‘given’ (‘(’ [DefParams] ‘)’ | GivenTypes)
8182
GivenTypes ::= AnnotType {‘,’ AnnotType}
8283
```

docs/docs/reference/contextual/instance-defs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ GivenParamClause ::= ‘given’ (‘(’ [DefParams] ‘)’ | GivenTypes)
7272
InstanceBody ::= [‘for’ ConstrApp {‘,’ ConstrApp }] [TemplateBody]
7373
| ‘for’ Type ‘=’ Expr
7474
GivenTypes ::= AnnotType {‘,’ AnnotType}
75+
ConstrApp ::= SimpleConstrApp
76+
| ‘(’ SimpleConstrApp {‘given’ (PrefixExpr | ParArgumentExprs)} ‘)’
7577
```
7678
The identifier `id` can be omitted only if either the `for` part or the template body is present.
7779
If the `for` part is missing, the template body must define at least one extension method.

0 commit comments

Comments
 (0)