diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index a5fb23aee0de..f0d04fffa5b1 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1843,12 +1843,12 @@ object Parsers { def typeParamClauseOpt(ownerKind: ParamOwner.Value): List[TypeDef] = if (in.token == LBRACKET) typeParamClause(ownerKind) else Nil - /** ClsParamClauses ::= {ClsParamClause} [[nl] `(' `implicit' ClsParams `)'] - * ClsParamClause ::= [nl] `(' [ClsParams] ')' + /** ClsParamClauses ::= {ClsParamClause} [[nl] `(' `implicit' [`unused'] ClsParams `)'] + * ClsParamClause ::= [nl] `(' [`unused'] [ClsParams] ')' * ClsParams ::= ClsParam {`' ClsParam} * ClsParam ::= {Annotation} [{Modifier} (`val' | `var') | `inline'] Param - * DefParamClauses ::= {DefParamClause} [[nl] `(' `implicit' DefParams `)'] - * DefParamClause ::= [nl] `(' [DefParams] ')' + * DefParamClauses ::= {DefParamClause} [[nl] `(' `implicit' [`unused'] DefParams `)'] + * DefParamClause ::= [nl] `(' [`unused'] [DefParams] ')' * DefParams ::= DefParam {`,' DefParam} * DefParam ::= {Annotation} [`inline'] Param * Param ::= id `:' ParamType [`=' Expr] @@ -1907,7 +1907,6 @@ object Parsers { if (in.token == RPAREN) Nil else { if (in.token == IMPLICIT || in.token == UNUSED) { - imods = EmptyModifiers if (in.token == IMPLICIT) { implicitOffset = in.offset imods = implicitMods(imods) @@ -1920,12 +1919,13 @@ object Parsers { } def clauses(): List[List[ValDef]] = { newLineOptWhenFollowedBy(LPAREN) - if (in.token == LPAREN) + if (in.token == LPAREN) { + imods = EmptyModifiers paramClause() :: { firstClauseOfCaseClass = false if (imods is Implicit) Nil else clauses() } - else Nil + } else Nil } val start = in.offset val result = clauses() diff --git a/tests/run/unused-4.check b/tests/run/unused-4.check index 7856232616cc..d0543377f8db 100644 --- a/tests/run/unused-4.check +++ b/tests/run/unused-4.check @@ -1,6 +1,6 @@ foo foo2 -fun +fun 42 foo foo2 -fun2 +fun2 abc diff --git a/tests/run/unused-4.scala b/tests/run/unused-4.scala index 7fbff5a2fba1..737e07aad384 100644 --- a/tests/run/unused-4.scala +++ b/tests/run/unused-4.scala @@ -16,10 +16,10 @@ object Test { } def fun(a: Int)(unused b: String): Unit = { - println("fun") + println("fun " + a) } def fun2(unused a: Int)(b: String): Unit = { - println("fun2") + println("fun2 " + b) } } diff --git a/tests/run/unused-5.check b/tests/run/unused-5.check index fb43511711cd..13382253141f 100644 --- a/tests/run/unused-5.check +++ b/tests/run/unused-5.check @@ -2,9 +2,9 @@ foo foo foo foo -fun +fun 42 42 foo foo foo foo -fun2 +fun2 42 42 diff --git a/tests/run/unused-5.scala b/tests/run/unused-5.scala index 6c12844eb546..8eae6a1e70ab 100644 --- a/tests/run/unused-5.scala +++ b/tests/run/unused-5.scala @@ -11,10 +11,10 @@ object Test { } def fun(a: Int)(unused b: Int)(c: Int)(unused d: Int): Unit = { - println("fun") + println("fun " + a + " " + c) } def fun2(unused a2: Int)(b2: Int)(unused c2: Int)(d2: Int): Unit = { - println("fun2") + println("fun2 " + b2 + " " + d2) } }