diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 7c17cf198d57..2d9d75b24f56 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -2455,7 +2455,7 @@ import transform.SymUtils._ |""".stripMargin } - class ModifierNotAllowedForDefinition(flag: Flag)(using Context) + class ModifierNotAllowedForDefinition(flag: FlagSet)(using Context) extends SyntaxMsg(ModifierNotAllowedForDefinitionID) { def msg = s"Modifier `${flag.flagsString}` is not allowed for this definition" def explain = "" diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 2fb4dd1cd8a2..2c9d48537f09 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -435,7 +435,7 @@ object Checking { if sym.isAllOf(flag1 | flag2) then fail(i"illegal combination of modifiers: `${flag1.flagsString}` and `${flag2.flagsString}` for: $sym") def checkApplicable(flag: FlagSet, ok: Boolean) = if (!ok && !sym.is(Synthetic)) - fail(ModifierNotAllowedForDefinition(Erased)) + fail(ModifierNotAllowedForDefinition(flag)) if (sym.is(Inline) && ( sym.is(ParamAccessor) && sym.owner.isClass