@@ -983,9 +983,15 @@ object Parsers {
983983 }
984984 else
985985 val t = reduceStack(base, top, minPrec, leftAssoc = true , in.name, isType)
986- if ! isType && in.token == MATCH then recur (matchClause(t))
986+ if ! isType && in.token == MATCH then recurAtMinPrec (matchClause(t))
987987 else t
988988
989+ def recurAtMinPrec (top : Tree ): Tree =
990+ if isIdent && isOperator && precedence(in.name) == minInfixPrec
991+ || in.token == MATCH
992+ then recur(top)
993+ else top
994+
989995 recur(first)
990996 }
991997
@@ -2758,8 +2764,8 @@ object Parsers {
27582764 /** OLD: GivenTypes ::= AnnotType {‘,’ AnnotType}
27592765 * NEW: GivenTypes ::= Type {‘,’ Type}
27602766 */
2761- def givenTypes (newStyle : Boolean , nparams : Int , ofClass : Boolean ): List [ValDef ] =
2762- val tps = commaSeparated(() => if newStyle then typ() else annotType() )
2767+ def givenTypes (nparams : Int , ofClass : Boolean ): List [ValDef ] =
2768+ val tps = commaSeparated(typ)
27632769 var counter = nparams
27642770 def nextIdx = { counter += 1 ; counter }
27652771 val paramFlags = if ofClass then Private | Local | ParamAccessor else Param
@@ -2862,7 +2868,7 @@ object Parsers {
28622868 || startParamTokens.contains(in.token)
28632869 || isIdent && (in.name == nme.inline || in.lookaheadIn(BitSet (COLON )))
28642870 if isParams then commaSeparated(() => param())
2865- else givenTypes(true , nparams, ofClass)
2871+ else givenTypes(nparams, ofClass)
28662872 checkVarArgsRules(clause)
28672873 clause
28682874 }
@@ -3477,12 +3483,11 @@ object Parsers {
34773483 val t = constrApp()
34783484 val ts =
34793485 if in.token == WITH then
3480- val lookahead = in.LookaheadScanner (indent = true )
3481- lookahead.nextToken( )
3482- if templateCanFollow && (lookahead .token == LBRACE || lookahead .token == INDENT ) then
3486+ in.nextToken( )
3487+ newLineOptWhenFollowedBy( LBRACE )
3488+ if templateCanFollow && (in .token == LBRACE || in .token == INDENT ) then
34833489 Nil
34843490 else
3485- in.nextToken()
34863491 checkNotWithAtEOL()
34873492 constrApps(commaOK, templateCanFollow)
34883493 else if commaOK && in.token == COMMA then
0 commit comments