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.

@SAY-5
SAY-5 force-pushed the fix-inline-subscript-index-20261001 branch 2 times, most recently from ecbb739 to ca3087d Compare October 25, 2026 05:41
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.34%. Comparing base (05b25ba) to head (ca3087d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #892   +/-   ##
=======================================
  Coverage   95.34%   95.34%           
=======================================
  Files         134      134           
  Lines       26762    26795   +33     
=======================================
+ Hits        25516    25549   +33     
  Misses       1246     1246           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcepl
mcepl requested a review from lieryan October 26, 2026 21:01

@mcepl mcepl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge IMHO

@SAY-5
SAY-5 force-pushed the fix-inline-subscript-index-20261001 branch from ca3087d to 5b6116e Compare November 16, 2026 20:45

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

2 participants