Skip to content

sealed final abstract case object Foo #4936

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

Closed
sir-wabbit opened this issue Aug 13, 2018 · 6 comments · Fixed by #4973
Closed

sealed final abstract case object Foo #4936

sir-wabbit opened this issue Aug 13, 2018 · 6 comments · Fixed by #4973

Comments

@sir-wabbit
Copy link

sir-wabbit commented Aug 13, 2018

Lots of modifiers are allowed on objects, but they do not seem to have any semantics.

In fact, you can have a

sealed final abstract case object Foo

But sadly

abstract object Foo {
  def x : String
}

doesn't compile, haha.

Perhaps those modifiers should be reported as errors?

@nafg
Copy link

nafg commented Aug 14, 2018

I guess you meant does or shouldn't?

@sir-wabbit
Copy link
Author

Updated the description 👍

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 21, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 21, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 21, 2018
@Blaisorblade Blaisorblade self-assigned this Aug 21, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 21, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 15, 2019
Fix scala#4936.

- Stop using final object in our sources.
- Give error for abstract and sealed objects, warning for final ones (as long as
- scala/bug#11094 is open).
@Blaisorblade
Copy link
Contributor

At least as long as scala/bug#11094 is open, I'd rather not forbid final object.

@nicolasstucki
Copy link
Contributor

We should just add a warning on the redundant modifier.

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 15, 2019
Fix scala#4936.

- Stop using final object in our sources.
- Give error for abstract and sealed objects, warning for final ones (as long as
- scala/bug#11094 is open).
@Blaisorblade
Copy link
Contributor

@nicolasstucki Can you review #4973?

@nicolasstucki
Copy link
Contributor

Yes

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 16, 2019
Fix scala#4936 in parser.

- Stop using final object in our sources.
- Give error for abstract and sealed objects, warning for final ones (as long as
- scala/bug#11094 is open).
- Address review comments.
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 16, 2019
Fix scala#4936 in parser.

- Stop using final object in our sources.
- Give error for abstract and sealed objects, warning for final ones (as long as
- scala/bug#11094 is open).
- Address review comments.
nicolasstucki added a commit that referenced this issue Jan 16, 2019
…-flags

Fix #4936: Forbid (or warn on) redundant/illegal object flags
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 16, 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`.
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Jan 17, 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`.
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue 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 added a commit that referenced this issue Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants