You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
def foo(): ...
def bar():
foos = ...
for foo in foos: ...
and then you do slicker oldfile.foo newfile.py to move foo to newfile.py. The result is this:
def bar():
foos = ...
for newfile.foo in foos: ...
which obviously is not correct.
The problem is that a variable is shadowing a function name, so while slicker thinks it's renaming a reference to the function it's actually renaming a reference to the variable.
I think that we could actually do a pretty good job with this, without too much trouble. The idea would be to see to find all places the symbol-to-rewrite is used in an assignment context (in this case "for foo in"), and go up the AST to the function that happens in, and don't do any renaming in that function. But I may be missing something that makes this too hacky to be useful in general.