Skip to content

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

Merged
merged 2 commits into from
Jan 19, 2019

Conversation

Blaisorblade
Copy link
Contributor

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).

@Blaisorblade Blaisorblade requested a review from odersky January 16, 2019 14:08
@Blaisorblade Blaisorblade self-assigned this Jan 16, 2019
@Blaisorblade Blaisorblade removed the request for review from odersky January 16, 2019 15:15
@Blaisorblade Blaisorblade force-pushed the fix-#4936-#4973-desugar branch from 93673e9 to 3db1783 Compare January 17, 2019 00:39

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)
Copy link
Contributor Author

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

@Blaisorblade Blaisorblade requested a review from odersky January 17, 2019 01:41
@Blaisorblade Blaisorblade assigned odersky and unassigned Blaisorblade Jan 17, 2019
@Blaisorblade Blaisorblade added the area:reporting Error reporting including formatting, implicit suggestions, etc label Jan 17, 2019
Copy link
Contributor

@odersky odersky left a 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.

@odersky
Copy link
Contributor

odersky commented Jan 19, 2019

@Blaisorblade Can be merged now after a rebase.

@odersky odersky assigned Blaisorblade and unassigned odersky Jan 19, 2019
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.
@Blaisorblade Blaisorblade force-pushed the fix-#4936-#4973-desugar branch from 3db1783 to 986c2df Compare January 19, 2019 13:20
@Blaisorblade Blaisorblade merged commit 7482735 into scala:master Jan 19, 2019
@Blaisorblade Blaisorblade deleted the fix-#4936-#4973-desugar branch January 19, 2019 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants