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 @@ -3673,7 +3673,10 @@ object Parsers {
3673
3673
// begin termParamClause
3674
3674
inParensWithCommas {
3675
3675
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
3677
3680
else
3678
3681
val clause =
3679
3682
if paramOwner == ParamOwner .ExtensionPrefix
@@ -4468,7 +4471,10 @@ object Parsers {
4468
4471
leadParamss += extParams
4469
4472
isUsingClause(extParams)
4470
4473
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
4472
4478
if in.isColon then
4473
4479
syntaxError(em " no `:` expected here " )
4474
4480
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