Skip to content

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