Skip to content

Commit 480cc0f

Browse files
authored
Merge pull request #11878 from bjornregnell/master
Fix #11872, correct error msg when modifier flag is not allowed
2 parents eeb8340 + b2d42dc commit 480cc0f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,7 @@ import transform.SymUtils._
24552455
|""".stripMargin
24562456
}
24572457

2458-
class ModifierNotAllowedForDefinition(flag: Flag)(using Context)
2458+
class ModifierNotAllowedForDefinition(flag: FlagSet)(using Context)
24592459
extends SyntaxMsg(ModifierNotAllowedForDefinitionID) {
24602460
def msg = s"Modifier `${flag.flagsString}` is not allowed for this definition"
24612461
def explain = ""

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ object Checking {
435435
if sym.isAllOf(flag1 | flag2) then fail(i"illegal combination of modifiers: `${flag1.flagsString}` and `${flag2.flagsString}` for: $sym")
436436
def checkApplicable(flag: FlagSet, ok: Boolean) =
437437
if (!ok && !sym.is(Synthetic))
438-
fail(ModifierNotAllowedForDefinition(Erased))
438+
fail(ModifierNotAllowedForDefinition(flag))
439439

440440
if (sym.is(Inline) &&
441441
( sym.is(ParamAccessor) && sym.owner.isClass

0 commit comments

Comments
 (0)