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

[red-knot] fix ordering of ClassDef semantic index building #16915

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

mtshiba
Copy link
Contributor

@mtshiba mtshiba commented Mar 22, 2025

Summary

From #16861

This PR fixes the incorrect ClassDef handling of SemanticIndexBuilder::visit_stmt, which fixes some of the incorrect behavior of referencing the class itself in the class scope (a complete fix requires a different fix, which will be done in the another PR).

Copy link
Contributor

github-actions bot commented Mar 22, 2025

mypy_primer results

No ecosystem changes detected ✅

@MichaReiser MichaReiser added the red-knot Multi-file analysis & type inference label Mar 22, 2025
@MichaReiser
Copy link
Member

MichaReiser commented Mar 22, 2025

It seems that #16916 contains the same changes. Is this intentional? Are those PRs stacked?

@mtshiba
Copy link
Contributor Author

mtshiba commented Mar 23, 2025

I separated the PRs because we needed to fix two different parts for the same issue.
I thought PR #16916 was dependent on this PR, but now I see that the test itself can pass on its own. Thus, the inclusion of this PR's commit in that PR's commits, while intentional, does not seem necessary.

@carljm carljm enabled auto-merge (squash) March 23, 2025 13:19
@carljm carljm merged commit ee51c2a into astral-sh:main Mar 23, 2025
22 checks passed
@mtshiba mtshiba deleted the fix-class-registration branch March 24, 2025 02:14
carljm pushed a commit that referenced this pull request Mar 28, 2025
## Summary

From #16861, and the continuation of #16915.

This PR fixes the incorrect behavior of
`TypeInferenceBuilder::infer_name_load` in eager nested scopes.

And this PR closes #16341.

## Test Plan

New test cases are added in `annotations/deferred.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants