@@ -2805,7 +2805,8 @@ object Parsers {
28052805 val tapp = atSpan(startOffset(t), in.offset) { TypeApply (t, typeArgs(namedOK = true , wildOK = false )) }
28062806 simpleExprRest(tapp, location, canApply = true )
28072807 case LPAREN | LBRACE | INDENT if canApply =>
2808- val app = atSpan(startOffset(t), in.offset) { mkApply(t, argumentExprs()) }
2808+ val openingToken = in.token
2809+ val app = atSpan(startOffset(t), in.offset) { mkApply(t, argumentExprs(), openingToken) }
28092810 if in.rewriteToIndent then
28102811 app match
28112812 case Apply (Apply (_, List (Block (_, _))), List (blk @ Block (_, _))) =>
@@ -2892,8 +2893,15 @@ object Parsers {
28922893 def argumentExprs (): (List [Tree ], Boolean ) =
28932894 if (in.isNestedStart) (blockExpr() :: Nil , false ) else parArgumentExprs()
28942895
2895- def mkApply (fn : Tree , args : (List [Tree ], Boolean )): Tree =
2896+ def mkApply (fn : Tree , args : (List [Tree ], Boolean ), openingToken : Token ): Tree =
28962897 val res = Apply (fn, args._1)
2898+ println(openingToken)
2899+ val applyStyle =
2900+ openingToken match
2901+ case LPAREN => ApplyStyle .Parentheses
2902+ case LBRACE => ApplyStyle .TrailingLambda
2903+ case COLONop => ApplyStyle .Colon
2904+ res.setApplyStyle(applyStyle)
28972905 if args._2 then res.setApplyKind(ApplyKind .Using )
28982906 res
28992907
@@ -2905,7 +2913,9 @@ object Parsers {
29052913 */
29062914 def argumentExprss (fn : Tree ): Tree = {
29072915 argumentStart()
2908- if (in.token == LPAREN || in.isNestedStart) argumentExprss(mkApply(fn, argumentExprs()))
2916+ if in.token == LPAREN || in.isNestedStart then
2917+ val openingToken = in.token
2918+ argumentExprss(mkApply(fn, argumentExprs(), openingToken))
29092919 else fn
29102920 }
29112921
@@ -2931,7 +2941,7 @@ object Parsers {
29312941 }
29322942 if (in.token == LPAREN && (! inClassConstrAnnots || isLegalAnnotArg))
29332943 parArgumentExprss(
2934- atSpan(startOffset(fn)) { mkApply(fn, parArgumentExprs()) }
2944+ atSpan(startOffset(fn)) { mkApply(fn, parArgumentExprs(), LPAREN ) }
29352945 )
29362946 else fn
29372947 }
@@ -4046,7 +4056,7 @@ object Parsers {
40464056 def selfInvocation (): Tree =
40474057 atSpan(accept(THIS )) {
40484058 argumentStart()
4049- argumentExprss(mkApply(Ident (nme.CONSTRUCTOR ), argumentExprs()))
4059+ argumentExprss(mkApply(Ident (nme.CONSTRUCTOR ), argumentExprs(), LPAREN ))
40504060 }
40514061
40524062 /** TypeDef ::= id [HkTypeParamClause] {FunParamClause} TypeAndCtxBounds [‘=’ Type]
0 commit comments