-
Notifications
You must be signed in to change notification settings - Fork 346
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
base: main
Are you sure you want to change the base?
Conversation
I noticed that sometimes rename worked on symbols not within the local scope and these checks should help.
def isLocal = | ||
sym.ownersIterator | ||
.drop(1) | ||
.exists(owner => owner.isMethod || owner.isAnonymousFunction) |
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.
Doesn't symbol simply have something like isLocal
? Or does it fail for Scala 2.11?
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.
There isisLocal
but it's not the same as we need. Some of the tests stop passing
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) |
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.
How does this work with e.g apply
or <init>
?
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.
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.
I noticed that sometimes rename worked on symbols not within the local scope and these checks should help.