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 {
850850 */
851851 def toplevelTyp (): Tree = rejectWildcardType(typ())
852852
853- /** Type ::= FunTypeMods FunArgTypes `=>' Type
854- * | HkTypeParamClause `=>>' Type
853+ /** Type ::= FunType
854+ * | HkTypeParamClause ‘=>>’ Type
855+ * | MatchType
855856 * | InfixType
857+ * FunType ::= { 'erased' | 'given' } (MonoFunType | PolyFunType)
858+ * MonoFunType ::= FunArgTypes ‘=>’ Type
859+ * PolyFunType ::= HKTypeParamClause '=>' Type
856860 * FunArgTypes ::= InfixType
857861 * | `(' [ FunArgType {`,' FunArgType } ] `)'
858862 * | '(' TypedFunParam {',' TypedFunParam } ')'
@@ -1234,6 +1238,7 @@ object Parsers {
12341238 * | `throw' Expr
12351239 * | `return' [Expr]
12361240 * | ForExpr
1241+ * | HkTypeParamClause ‘=>’ Expr
12371242 * | [SimpleExpr `.'] id `=' Expr
12381243 * | SimpleExpr1 ArgumentExprs `=' Expr
12391244 * | Expr2
Original file line number Diff line number Diff line change @@ -139,10 +139,13 @@ ClassQualifier ::= ‘[’ id ‘]’
139139
140140### Types
141141``` 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)
144144 | MatchType
145145 | InfixType
146+ FunType ::= { 'erased' | 'given' } (MonoFunType | PolyFunType)
147+ MonoFunType ::= FunArgTypes ‘=>’ Type Function(ts, t)
148+ PolyFunType :: = HKTypeParamClause '=>' Type PolyFunction(ps, t)
146149FunArgTypes ::= InfixType
147150 | ‘(’ [ FunArgType {‘,’ FunArgType } ] ‘)’
148151 | ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
@@ -195,6 +198,7 @@ Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl}
195198 | ‘throw’ Expr Throw(expr)
196199 | ‘return’ [Expr] Return(expr?)
197200 | ForExpr
201+ | HkTypeParamClause ‘=>’ Expr PolyFunction(ts, expr)
198202 | [SimpleExpr ‘.’] id ‘=’ Expr Assign(expr, expr)
199203 | SimpleExpr1 ArgumentExprs ‘=’ Expr Assign(expr, expr)
200204 | Expr2
You can’t perform that action at this time.
0 commit comments