Skip to content

Preserve subscript index reads during method inlining - #892

Open
SAY-5 wants to merge 1 commit into
python-rope:masterfrom
SAY-5:fix-inline-subscript-index-20261001
Open

SAY-5 wants to merge 1 commit into
python-rope:masterfrom
SAY-5:fix-inline-subscript-index-20261001

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 2, 2026

Copy link
Copy Markdown

Description

Inlining a function that assigns get_registry()[name] = value leaves name in the result instead of substituting the argument. Worder classifies the index as an assignment target when it sees a closing bracket before =.

Recognize that index as a read while preserving grouped and list assignment targets. Add regressions for subscript and slice indices, assignment/comparison operators, and the complete inline transformation.

Fixes #827

Validation

  • The new assignment-classification and inline regressions fail on the original code and pass with this change; the focused run passes all 69 tests.
  • Full suite on macOS ARM64, Python 3.13.9: 2,158 passed, 7 skipped, 5 xfailed. The run retains existing warnings, including a coverage warning for a deleted temporary fixture.
  • Black 26.5.1: all 96 files selected by the repository configuration pass. git diff --check passes.

Checklist

  • I have added tests that prove my fix is effective
  • I have updated CHANGELOG.md

AI assistance: Codex assisted with the implementation, tests, review, and this description.

This branch has not been deployed

No deployments
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.

The Inline Method refactoring does not inline all the attributes

1 participant