File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -850,9 +850,13 @@ object Parsers {
850
850
*/
851
851
def toplevelTyp (): Tree = rejectWildcardType(typ())
852
852
853
- /** Type ::= FunTypeMods FunArgTypes `=>' Type
854
- * | HkTypeParamClause `=>>' Type
853
+ /** Type ::= FunType
854
+ * | HkTypeParamClause ‘=>>’ Type
855
+ * | MatchType
855
856
* | InfixType
857
+ * FunType ::= { 'erased' | 'given' } (MonoFunType | PolyFunType)
858
+ * MonoFunType ::= FunArgTypes ‘=>’ Type
859
+ * PolyFunType ::= HKTypeParamClause '=>' Type
856
860
* FunArgTypes ::= InfixType
857
861
* | `(' [ FunArgType {`,' FunArgType } ] `)'
858
862
* | '(' TypedFunParam {',' TypedFunParam } ')'
@@ -1234,6 +1238,7 @@ object Parsers {
1234
1238
* | `throw' Expr
1235
1239
* | `return' [Expr]
1236
1240
* | ForExpr
1241
+ * | HkTypeParamClause ‘=>’ Expr
1237
1242
* | [SimpleExpr `.'] id `=' Expr
1238
1243
* | SimpleExpr1 ArgumentExprs `=' Expr
1239
1244
* | Expr2
Original file line number Diff line number Diff line change @@ -139,10 +139,13 @@ ClassQualifier ::= ‘[’ id ‘]’
139
139
140
140
### Types
141
141
``` ebnf
142
- Type ::= { ‘erased’ | ‘given’} FunArgTypes ‘=>’ Type Function(ts, t)
143
- | HkTypeParamClause ‘=>>’ Type TypeLambda(ps, t)
142
+ Type ::= FunType
143
+ | HkTypeParamClause ‘=>>’ Type TypeLambda(ps, t)
144
144
| MatchType
145
145
| InfixType
146
+ FunType ::= { 'erased' | 'given' } (MonoFunType | PolyFunType)
147
+ MonoFunType ::= FunArgTypes ‘=>’ Type Function(ts, t)
148
+ PolyFunType :: = HKTypeParamClause '=>' Type PolyFunction(ps, t)
146
149
FunArgTypes ::= InfixType
147
150
| ‘(’ [ FunArgType {‘,’ FunArgType } ] ‘)’
148
151
| ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
@@ -195,6 +198,7 @@ Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl}
195
198
| ‘throw’ Expr Throw(expr)
196
199
| ‘return’ [Expr] Return(expr?)
197
200
| ForExpr
201
+ | HkTypeParamClause ‘=>’ Expr PolyFunction(ts, expr)
198
202
| [SimpleExpr ‘.’] id ‘=’ Expr Assign(expr, expr)
199
203
| SimpleExpr1 ArgumentExprs ‘=’ Expr Assign(expr, expr)
200
204
| Expr2
You can’t perform that action at this time.
0 commit comments