@@ -1358,17 +1358,17 @@ object Parsers {
13581358 case _ => false
13591359 }
13601360
1361- /** Type ::= FunType
1362- * | HkTypeParamClause ‘=>>’ Type
1363- * | ‘(’ TypedFunParams ‘)’ ‘=>>’ Type
1364- * | MatchType
1365- * | InfixType
1366- * FunType ::= (MonoFunType | PolyFunType)
1367- * MonoFunType ::= FunArgTypes (‘=>’ | ‘?=>’) Type
1368- * PolyFunType ::= HKTypeParamClause '=>' Type
1369- * FunArgTypes ::= InfixType
1370- * | `(' [ [ ‘[using]’ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
1371- * | '(' [ ‘[using]’ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
1361+ /** Type ::= FunType
1362+ * | HkTypeParamClause ‘=>>’ Type
1363+ * | FunParamClause ‘=>>’ Type
1364+ * | MatchType
1365+ * | InfixType
1366+ * FunType ::= (MonoFunType | PolyFunType)
1367+ * MonoFunType ::= FunArgTypes (‘=>’ | ‘?=>’) Type
1368+ * PolyFunType ::= HKTypeParamClause '=>' Type
1369+ * FunArgTypes ::= InfixType
1370+ * | `(' [ [ ‘[using]’ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
1371+ * | '(' [ ‘[using]’ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
13721372 */
13731373 def typ (): Tree = {
13741374 val start = in.offset
@@ -1511,10 +1511,19 @@ object Parsers {
15111511 Span (start, start + nme.IMPLICITkw .asSimpleName.length)
15121512
15131513 /** TypedFunParam ::= id ':' Type */
1514- def typedFunParam (start : Offset , name : TermName , mods : Modifiers = EmptyModifiers ): Tree = atSpan(start) {
1515- accept(COLON )
1516- makeParameter(name, typ(), mods | Param )
1517- }
1514+ def typedFunParam (start : Offset , name : TermName , mods : Modifiers = EmptyModifiers ): ValDef =
1515+ atSpan(start) {
1516+ accept(COLON )
1517+ makeParameter(name, typ(), mods | Param )
1518+ }
1519+
1520+ /** FunParamClause ::= ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
1521+ */
1522+ def funParamClause (): List [ValDef ] =
1523+ inParens(commaSeparated(() => typedFunParam(in.offset, ident())))
1524+
1525+ def funParamClauses (): List [List [ValDef ]] =
1526+ if in.token == LPAREN then funParamClause() :: funParamClauses() else Nil
15181527
15191528 /** InfixType ::= RefinedType {id [nl] RefinedType}
15201529 */
@@ -3394,15 +3403,16 @@ object Parsers {
33943403 argumentExprss(mkApply(Ident (nme.CONSTRUCTOR ), argumentExprs()))
33953404 }
33963405
3397- /** TypeDcl ::= id [TypeParamClause] TypeBounds [‘=’ Type]
3406+ /** TypeDcl ::= id [TypeParamClause] {FunParamClause} TypeBounds [‘=’ Type]
33983407 */
33993408 def typeDefOrDcl (start : Offset , mods : Modifiers ): Tree = {
34003409 newLinesOpt()
34013410 atSpan(start, nameStart) {
34023411 val nameIdent = typeIdent()
34033412 val tparams = typeParamClauseOpt(ParamOwner .Type )
3413+ val vparamss = funParamClauses()
34043414 def makeTypeDef (rhs : Tree ): Tree = {
3405- val rhs1 = lambdaAbstract (tparams, rhs)
3415+ val rhs1 = lambdaAbstractAll (tparams :: vparamss , rhs)
34063416 val tdef = TypeDef (nameIdent.name.toTypeName, rhs1)
34073417 if (nameIdent.isBackquoted)
34083418 tdef.pushAttachment(Backquoted , ())
0 commit comments