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

Fix type aliases with fixed-length tuples #14184

Merged
merged 7 commits into from
Nov 25, 2022
Merged

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Nov 25, 2022

Fix type aliases like these:

T = tuple[int, str]

Type applications involving fixed-length tuples still don't fully work. The inferred type is a variable-length tuple when constructing a tuple using a type application, e.g. tuple[int, str]((1, "")). This seems a pretty low-priority issue, whereas the type alias use case seems common.

Most of the work was by @sobolevn originally in #12134. I just finished it up.

Fixes #11098.

@github-actions
Copy link
Contributor

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

artigraph (https://github.com/artigraph/artigraph)
+ tests/arti/types/test_python_adapters.py:188: error: Unused "type: ignore" comment
+ tests/arti/internal/test_models.py:183: error: Unused "type: ignore" comment
+ tests/arti/internal/test_models.py:192: error: Unused "type: ignore" comment

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks for helping me out on this one!

@JukkaL JukkaL merged commit a9024a8 into master Nov 25, 2022
@JukkaL JukkaL deleted the fix-tuple-type-application branch November 25, 2022 12:58
@harahu
Copy link

harahu commented Nov 25, 2022

I just ran into this (#11098) issue in one of my code bases today. I go to github to see whether it's been reported before, and whether it is being worked on. What am I greeted by?

Screenshot from 2022-11-25 13-56-00

and then...

Screenshot from 2022-11-25 13-53-19

I absolutely love you guys. ❤️

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