Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Improve error message for bound typevar in TypeAliasType#17053
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
hamdanal commentedMar 20, 2024
It would be nice to also get rid of the second remaining error, but this will require adding a special-cased context only for analyzing |
According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Follow up to#17038
When a type variable is bound to a class, it cannot be reused in a type alias. Previously in
TypeAliasType, this error was reported as "not included in type_params". However in the following example, the error is misleading:On the master branch:
With this PR:
This is possible by storing the names of all the declared type_params, even those that are invalid, and checking if the offending type variables are in the list.