-
-
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
Use alias names in error messages #2968
Comments
Agreed that your proposed message would be better. Mypy currently expands aliases eagerly and doesn't keep track of the name of the alias, so this would be somewhat non-trivial to support. |
Since this feature clearly isn't a priority to the maintainers; could I have any indication as to how to even start if I were to try to implement this in a fork ? |
I think some work has been done since 2017 that should make it a bit easier. Look for |
I've looked into this, and there are 2 issues that will probably make this somewhat hard to implement completely:
I should be able to create a PR soon that starts to implement this. So far, I'm just fixing examples of problem 1 everywhere I happen to find, and I'm leaving out a fix for problem 2 (removing that optimization doesn't seem hard but it definitely seems nontrivial). |
Given:
mypy detect the incorrect first argument:
However, it would be much nicer is the error reporting could have used the alias name:
tmp.py:12: error: Argument 1 to "dist" has incompatible type "str"; expected "Centroid", which expands to Tuple[float, ...]
I realize it may be easy to do, but it would improve the usability of aliases.
The text was updated successfully, but these errors were encountered: