-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Recursive type aliases tracker #7904
Comments
Recursive types should work with pytype. We don't support the
(I also changed the |
FWIW mypy version in master supports this under a flag (expect it fails on the last line because of an unrelated bug in special-casing tuple literals, should be a 1-line fix). |
In general, I guess we will discover a bunch of inconsistencies in type inference in mypy (currently it is a bit arbitrary in some situations, while it should be quite consistent for recursive types, especially if invariant collections are involved, e.g. this test passes if I use |
It is a minor change to fix the example in python/typeshed#7904
This comment was marked as off-topic.
This comment was marked as off-topic.
Seems like we're all done here! We have our first recursive types successfully added to typeshed: #9134 Thanks @ilevkivskyi for all the incredible work on mypy recently to enable this! |
These are not working for me:
gives:
|
Python version 3.11.2 (which should include whatever work happened in Nov 2022 on mypy). |
This issue is about support in type checkers, not at runtime. To prevent the runtime NameError you'll (still) have to enclose the name in quotes. |
Test case:
The text was updated successfully, but these errors were encountered: