-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Revise #4973: move fix of #4936 into desugar #5723
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
Revise #4973: move fix of #4936 into desugar #5723
Conversation
93673e9
to
3db1783
Compare
|
||
if (mods.is(Abstract)) | ||
ctx.error(hl"""$Abstract modifier cannot be used for objects""", flagPos(Abstract)) | ||
if (mods.is(Sealed)) | ||
ctx.error(hl"""$Sealed modifier is redundant for objects""", flagPos(Sealed)) | ||
// Maybe this should be an error; see https://github.com/scala/bug/issues/11094. | ||
if (mods.is(Final)) | ||
if (mods.is(Final) && !mods.is(Synthetic)) | ||
ctx.warning(hl"""$Final modifier is redundant for objects""", flagPos(Final)) | ||
|
||
if (mods is Package) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should fix the crashes in http://dotty-ci.epfl.ch/lampepfl/dotty/9779/5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but let's wait until source positions are in before merging. We probably will need one more rebase.
@Blaisorblade Can be merged now after a rebase. |
This follows again the original strategy in 1ecf67b. This check is at the latest possible point: a few lines later, `RetainedModuleValFlags` excludes `Abstract` and `Sealed` while `ModuleValCreationFlags` adds `Final`. Unlike in Parsers, at this point in Desugar we get Synthetic objects. We also get objects with flags but without corresponding mods; they might all be synthetic, but let's harden flagSpan anyway.
3db1783
to
986c2df
Compare
Revise #4973: move fix of #4936 into desugar.
As requested by @odersky, this reverts the changes to Parser and moves the checking to Desugar. These checks can't be done later (see commit msg for why).