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

Avoid false "Incompatible return value type" errors when dealing with isinstance, constrained type variables and multiple inheritance (Fixes #13800) #14390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tyralla
Copy link
Collaborator

@tyralla tyralla commented Jan 4, 2023

Avoid false "Incompatible return value type" errors when dealing with isinstance, constrained type variables and multiple inheritance (Fixes #13800).

The idea is to make a union of the current expanded return type and the previously expanded return types if the latter are among the bases of intersections generated by isinstance checks.

… `isinstance`, constrained type variables and multiple inheritance (fixes python#13800).

The idea is to make a union of the current expanded return type and the previously expanded return types if the latter are among the bases of intersections generated by `isinstance` checks.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

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

@tyralla
Copy link
Collaborator Author

tyralla commented Jan 4, 2023

@hauntsaninja: I could not resist checking if I could solve the issue relatively cleanly. Mypy's multi-pass approach for constrained type variables makes my solution more "global" than I hoped (I mean the addition of a new TypeChecker attribute). Still, it is not too invasive, in my opinion. Would you like to review it?

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.

Type Narrowing failure in 0.981
1 participant