Skip to content

InlineVariable produce incorrect code when variable declaration is semicolon-joined or serial assignment #864

Description

@lieryan

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
# example 1
s = "c"; n = 10
print(n, s)
# example 2
s = n = 10
print(n, s)
  1. Describe the refactoring you want to do: Inline variable s

  2. Expected code after refactoring:

# example 1
n = 10
print(n, "c")
# example 2
n = 10
print(n, 10)
  1. Describe the error or unexpected result that you are getting
# example 1
print(n, "c"; n = 10)
# example 2
print(n, n = 10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect user-visible behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions