Skip to content

Commit b5f65f5

Browse files
authored
Merge pull request #9127 from dotty-staging/fix-#9046
Fix #9046: Allow inline as parameter name
2 parents 98fc019 + 63233cd commit b5f65f5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,13 +2813,14 @@ object Parsers {
28132813
def modifiers(allowed: BitSet = modifierTokens, start: Modifiers = Modifiers()): Modifiers = {
28142814
@tailrec
28152815
def loop(mods: Modifiers): Modifiers =
2816-
if (allowed.contains(in.token) ||
2817-
in.isSoftModifier &&
2818-
localModifierTokens.subsetOf(allowed)) { // soft modifiers are admissible everywhere local modifiers are
2816+
if allowed.contains(in.token)
2817+
|| in.isSoftModifier
2818+
&& localModifierTokens.subsetOf(allowed) // soft modifiers are admissible everywhere local modifiers are
2819+
&& in.lookahead.token != COLON
2820+
then
28192821
val isAccessMod = accessModifierTokens contains in.token
28202822
val mods1 = addModifier(mods)
28212823
loop(if (isAccessMod) accessQualifierOpt(mods1) else mods1)
2822-
}
28232824
else if (in.token == NEWLINE && (mods.hasFlags || mods.hasAnnotations)) {
28242825
in.nextToken()
28252826
loop(mods)

tests/pos/i9046.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class C(inline: String)

0 commit comments

Comments
 (0)