-
Notifications
You must be signed in to change notification settings - Fork 17
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
Decorators are not covered when replacing decorated definitions #55
Comments
We need this feature as well, given we have some manual |
Adding some observation (bear in mind I may not fully understand the issue). When comparing the original
and
But
Based on the diff, the decorator would be duplicated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Replace()
action depends on the positions that are present in the original AST node. But for definitions likeFunctionDef
(and all other decorated ones), thelineno
points to the introducer keyword (likedef
inFunctionDef
) instead of the first decorator. So when we are replacing the whole function, we leave decorators behind which causes a lot of problems. We should account for this inReplace
(and others where we care about the position).Example Source Code
The text was updated successfully, but these errors were encountered: