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

Extract method only with instance variable change assigment #376

Closed
climbus opened this issue Sep 9, 2021 · 0 comments · Fixed by #391
Closed

Extract method only with instance variable change assigment #376

climbus opened this issue Sep 9, 2021 · 0 comments · Fixed by #391
Labels
affected-version:0.19 bug Unexpected or incorrect user-visible behavior extract-refactor
Milestone

Comments

@climbus
Copy link
Contributor

climbus commented Sep 9, 2021

Given class:

class A(object):
    def func(self):
        self.var_a = 1
        var_bb = self.var_a

When extracting method with selected instance variable var_bb = [self.var_a] and selected similar to True

Then changing var_a assignment:

class A(object):
    def func(self):
        self.new_func() = 1
        ^^^^^^^^^^^^^^^
        var_bb = self.new_func()

    def new_func(self):
        return self.var_a

Should be:

class A(object):
    def func(self):
        self.var_a = 1
        var_bb = self.new_func()

    def new_func(self):
        return self.var_a

@lieryan lieryan added affected-version:0.19 bug Unexpected or incorrect user-visible behavior extract-refactor labels Sep 9, 2021
@lieryan lieryan added this to the 0.21.x milestone Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-version:0.19 bug Unexpected or incorrect user-visible behavior extract-refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants