Skip to content

Fix #11872, correct error msg when modifier flag is not allowed #11878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/reporting/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down