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

Fall back to satisfiable constraints in unions #13467

Merged
merged 2 commits into from
Aug 21, 2022

Conversation

ilevkivskyi
Copy link
Member

Fixes #13456

The fix required me to refactor the Constraint class to preserve the original type variable, but I think this is actually a good thing, as it can help with fixing other type inference issues (and turned out to not be a big refactoring after all).

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Hooray! Yeah, the refactor would have been much harder before #9951

@ilevkivskyi
Copy link
Member Author

@hauntsaninja Thanks for removing the TypeVarDef! I guess now fixing the remaining things in #4814 are also more feasible now.

@ilevkivskyi ilevkivskyi merged commit 08ddf1c into python:master Aug 21, 2022
@ilevkivskyi ilevkivskyi deleted the try-fix-union-generic-bound branch August 21, 2022 19:22
@ilevkivskyi
Copy link
Member Author

Btw, I think the actual impact of non-refactor part of this PR will be quite minor, because using a type variable with an upper bound in covariant collections is almost always can be replaced with the upper bound itself.

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.

Mypy incorrectly complains about overloads being incorrect
2 participants