File tree 2 files changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/parsing
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -3412,7 +3412,10 @@ object Parsers {
3412
3412
// begin termParamClause
3413
3413
inParensWithCommas {
3414
3414
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
3416
3419
else
3417
3420
val clause =
3418
3421
if paramOwner == ParamOwner .ExtensionPrefix
@@ -4060,7 +4063,10 @@ object Parsers {
4060
4063
leadParamss += extParams
4061
4064
isUsingClause(extParams)
4062
4065
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
4064
4070
if in.isColon then
4065
4071
syntaxError(em " no `:` expected here " )
4066
4072
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