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 @@ -3412,7 +3412,10 @@ object Parsers {
34123412 // begin termParamClause
34133413 inParensWithCommas {
34143414 if in.token == RPAREN && paramOwner != ParamOwner .ExtensionPrefix && ! impliedMods.is(Given )
3415- then Nil
3415+ then
3416+ if paramOwner.takesOnlyUsingClauses then
3417+ syntaxError(em " `using` expected " )
3418+ Nil
34163419 else
34173420 val clause =
34183421 if paramOwner == ParamOwner .ExtensionPrefix
@@ -4060,7 +4063,10 @@ object Parsers {
40604063 leadParamss += extParams
40614064 isUsingClause(extParams)
40624065 do ()
4063- leadParamss ++= termParamClauses(ParamOwner .ExtensionFollow , numLeadParams)
4066+ // Empty parameter clauses are filtered out. They are already reported as syntax errors and are not
4067+ // allowed here.
4068+ val extFollowParams = termParamClauses(ParamOwner .ExtensionFollow , numLeadParams).filterNot(_.isEmpty)
4069+ leadParamss ++= extFollowParams
40644070 if in.isColon then
40654071 syntaxError(em " no `:` expected here " )
40664072 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