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

Unwrap type[Union[...]] when solving typevar constraints #18266

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

Conversation

sterliakov
Copy link
Contributor

Closes #18265, closes #12115.

type[A | B] is internally represented as type[A] | type[B], and this causes problems for a typevar solver. Prevent using meet in such cases by unwraping type[...] if both sides have such shape.

Copy link
Contributor

github-actions bot commented Dec 8, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/annotations.py:1064: error: Incompatible return value type (got "object", expected "User | Role | Snowflake | _T")  [return-value]

@sterliakov
Copy link
Contributor Author

Primer diff is fine, it was a false positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant