File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -3673,7 +3673,10 @@ object Parsers {
36733673 // begin termParamClause
36743674 inParensWithCommas {
36753675 if in.token == RPAREN && paramOwner != ParamOwner .ExtensionPrefix && ! impliedMods.is(Given )
3676- then Nil
3676+ then
3677+ if paramOwner.takesOnlyUsingClauses then
3678+ syntaxError(em " `using` expected " )
3679+ Nil
36773680 else
36783681 val clause =
36793682 if paramOwner == ParamOwner .ExtensionPrefix
@@ -4468,7 +4471,10 @@ object Parsers {
44684471 leadParamss += extParams
44694472 isUsingClause(extParams)
44704473 do ()
4471- leadParamss ++= termParamClauses(ParamOwner .ExtensionFollow , numLeadParams)
4474+ // Empty parameter clauses are filtered out. They are already reported as syntax errors and are not
4475+ // allowed here.
4476+ val extFollowParams = termParamClauses(ParamOwner .ExtensionFollow , numLeadParams).filterNot(_.isEmpty)
4477+ leadParamss ++= extFollowParams
44724478 if in.isColon then
44734479 syntaxError(em " no `:` expected here " )
44744480 in.nextToken()
Original file line number Diff line number Diff line change 1+ extension(x : Any )() // error
2+ def f = 42
3+ val x = Nil .f
You can’t perform that action at this time.
0 commit comments