Skip to content

Fix #864: preserve compound assignments when inlining - #866

Open
onuracar-dev wants to merge 1 commit into
python-rope:masterfrom
onuracar-dev:fix/864-inline-compound-assignments
Open

Fix #864: preserve compound assignments when inlining#866
onuracar-dev wants to merge 1 commit into
python-rope:masterfrom
onuracar-dev:fix/864-inline-compound-assignments

Conversation

@onuracar-dev

@onuracar-dev onuracar-dev commented Aug 30, 2026

Copy link
Copy Markdown

Description

Inline variable definitions now use the assignment AST to isolate the value and remove only the selected target or statement. This preserves sibling semicolon statements and remaining chained-assignment targets while retaining formatting such as outer parentheses.

Fixes #864

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have updated CHANGELOG.md
  • I have made corresponding changes to user documentation for new features (not applicable: bug fix)
  • I have made corresponding changes to library documentation for API changes (not applicable: no API change)

Validation

  • .venv\Scripts\python.exe -m pytest ropetest/refactor/inlinetest.py -q (109 passed)
  • .venv\Scripts\python.exe -m pytest -q (2122 passed, 12 skipped, 5 xfailed)
  • .venv\Scripts\python.exe -m pre_commit run --files rope/refactor/inline.py ropetest/refactor/inlinetest.py CHANGELOG.md
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant