-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Ban bogus "existential types" #7084
Labels
Comments
ilevkivskyi
added
bug
mypy got something wrong
topic-type-variables
priority-1-normal
labels
Jun 27, 2019
ilevkivskyi
added a commit
that referenced
this issue
Nov 24, 2022
Fixes #11855 Fixes #7084 Fixes #10445 Should fix #4987 After thinking about this for some time, it looks like the best way to implement this is by switching type aliases from unbound to bound type variables. Then I can essentially simply share (or copy in one small place, to avoid cyclic imports) all the logic that currently exists for `ParamSpec` and `Concatenate` in `expand_type()` etc. This will also address a big piece of tech debt, and will get some benefits (almost) for free, such as checking bounds/values for alias type variables, and much tighter handling of unbound type variables. Note that in this PR I change logic for emitting some errors, I try to avoid showing multiple errors for the same location/reason. But this is not an essential part of this PR (it is just some test cases would otherwise fail with even more error messages), I can reconsider if there are objections.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is possible to get an unbound type variable in a variable type using a generic alias, for example:
This doesn't makes sense currently and should give an error.
See also #6520 (this looks very similar but is actually a different issue specific to type aliases).
The text was updated successfully, but these errors were encountered: