File tree 1 file changed +15
-6
lines changed
compiler/src/dotty/tools/dotc/parsing 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -2322,10 +2322,11 @@ object Parsers {
2322
2322
if in.token == RPAREN then
2323
2323
Nil
2324
2324
else
2325
- var mods1 = mods
2326
- if isErased then mods1 = addModifier(mods1)
2327
2325
try
2328
- commaSeparated(() => binding(mods1))
2326
+ commaSeparated(() =>
2327
+ val mods1 = if isErased then addModifier(mods) else mods
2328
+ binding(mods1)
2329
+ )
2329
2330
finally
2330
2331
accept(RPAREN )
2331
2332
else {
@@ -3249,14 +3250,22 @@ object Parsers {
3249
3250
if prefix && ! isIdent(nme.using) && ! isIdent(nme.erased) then param() :: Nil
3250
3251
else
3251
3252
paramMods()
3253
+ val firstParamMod =
3254
+ var mods = EmptyModifiers
3255
+ if isErased then mods = addModifier(mods)
3256
+ if in.name == nme.inline then mods = addModifier(mods)
3257
+ mods
3252
3258
if givenOnly && ! impliedMods.is(Given ) then
3253
3259
syntaxError(em " `using` expected " )
3254
3260
val isParams =
3255
3261
! impliedMods.is(Given )
3256
3262
|| startParamTokens.contains(in.token)
3257
- || isIdent && (in.name == nme.inline || in.name == nme.erased || in.lookahead.isColon)
3258
- if isParams then commaSeparated(() => param())
3259
- else contextTypes(ofClass, nparams, impliedMods)
3263
+ || isIdent && in.lookahead.isColon
3264
+ (if isParams then commaSeparated(() => param())
3265
+ else contextTypes(ofClass, nparams, impliedMods)) match {
3266
+ case Nil => Nil
3267
+ case (h :: t) => h.withAddedFlags(firstParamMod.flags) :: t
3268
+ }
3260
3269
checkVarArgsRules(clause)
3261
3270
clause
3262
3271
}
You can’t perform that action at this time.
0 commit comments