rope
rope copied to clipboard
Rename refactoring doesn't rename a function's default arguments when the renamed variable is defined in the class scope
Applying the Rename refactoring to the following program causes runtime problems.
Steps to reproduce the behavior:
- Code before refactoring:
import nltk
class Word:
PorterStemmer = nltk.stem.porter.PorterStemmer()
def stem(self, stemmer=PorterStemmer):
return stemmer.stem('')
-
Apply the Rename refactoring to the variable "PorterStemmer"
-
Expected code after refactoring:
import nltk
class Word:
PorterStemmer_refactored = nltk.stem.porter.PorterStemmer()
def stem(self, stemmer=PorterStemmer_refactored):
return stemmer.stem('')
- In the function "stem", the parameter type is not refactored to the new name. Code after refactoring:
import nltk
class Word:
PorterStemmer_refactored = nltk.stem.porter.PorterStemmer()
def stem(self, stemmer=PorterStemmer):
return stemmer.stem('')