Skip to content
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

Keep modifiers when implementing abstract members #1762

Merged
merged 4 commits into from
May 19, 2020

Conversation

kpbochenek
Copy link
Contributor

@kpbochenek kpbochenek commented May 18, 2020

Fixes #1759

Not sure if this is a bug or intended behaviour but flagString generates modifiers like protected[package x.y.z] and they need to be stripped manually.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at it! I think it's almost ready, but I left some comments

@@ -213,6 +213,16 @@ trait OverrideCompletions { this: MetalsGlobal =>
if (sym.isLazy) "lazy "
else ""

val _modifs = sym.flagString
.replace("package ", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do this? We are not doing overrides for any of those symbol types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a bug or intended behaviour but flagString generates modifiers like protected[package x.y.z] and they need to be stripped manually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about object, trait or class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handled already

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, does those keywords can appear here even? You mentioned protected[package x.y.z] , but why would trait appear here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scala> trait A {
     |   trait AB {
     |     private[A] val x = 3
     |   }
     | }
trait A

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do:

      val _modifs =
        sym.flagString.replace(
          sym.privateWithin.toString(),
          sym.privateWithin.name.toString()
        )

@ckipp01 ckipp01 added bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler labels May 18, 2020
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tgodzik tgodzik merged commit 2e62ed4 into scalameta:master May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Implement all members" ignores access modifier
3 participants