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

chore: Check name when renaming #7199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Feb 7, 2025

I noticed that sometimes rename worked on symbols not within the local scope and these checks should help.

I noticed that sometimes rename worked on symbols not within the local scope and these checks should help.
Comment on lines +28 to +31
def isLocal =
sym.ownersIterator
.drop(1)
.exists(owner => owner.isMethod || owner.isAnonymousFunction)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't symbol simply have something like isLocal? Or does it fail for Scala 2.11?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There isisLocal but it's not the same as we need. Some of the tests stop passing

@tgodzik tgodzik requested a review from kasiaMarek February 7, 2025 17:14
owner.isMethod || owner.isAnonymousFunction
)) // this also works for worksheets, since they are wrapped in `method main`
val name = sym.decodedName.toString
def sameName = soughtSymbolNames(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this work with e.g apply or <init>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added them to forbidden methods. We could work something out with apply, but I don't really want to tackle it now and it's a rare enough scenario.

@tgodzik tgodzik requested a review from kasiaMarek February 7, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants