@@ -671,11 +671,14 @@ object Parsers {
671671 ts.toList
672672 else leading :: Nil
673673
674- def maybeNamed (op : () => Tree ): () => Tree = () =>
674+ def maybeNamed (location : Location , op : () => Tree ): () => Tree = () =>
675675 if isIdent && in.lookahead.token == EQUALS && sourceVersion.enablesNamedTuples then
676676 atSpan(in.offset):
677677 val name = ident()
678678 in.nextToken()
679+ if location.inPattern && in.token == INDENT then
680+ in.currentRegion = in.currentRegion.outer
681+ in.nextToken()
679682 NamedArg (name, op())
680683 else op()
681684
@@ -2958,7 +2961,7 @@ object Parsers {
29582961 if isErased then isFormalParams = true
29592962 if isFormalParams then binding(Modifiers ())
29602963 else
2961- val t = maybeNamed(exprInParens)()
2964+ val t = maybeNamed(Location . InParens , exprInParens)()
29622965 if t.isInstanceOf [ValDef ] then isFormalParams = true
29632966 t
29642967 commaSeparatedRest(exprOrBinding(), exprOrBinding)
@@ -3411,8 +3414,8 @@ object Parsers {
34113414 * | NamedPattern {‘,’ NamedPattern}
34123415 * NamedPattern ::= id '=' Pattern
34133416 */
3414- def patterns (location : Location = Location .InPattern ): List [Tree ] =
3415- commaSeparated(maybeNamed(() => pattern(location)))
3417+ def patterns (location : Location = Location .InPattern ): List [Tree ] = // default used from Markup
3418+ commaSeparated(maybeNamed(location, () => pattern(location)))
34163419 // check that patterns are all named or all unnamed is done at desugaring
34173420
34183421 def patternsOpt (location : Location = Location .InPattern ): List [Tree ] =
0 commit comments