-
Notifications
You must be signed in to change notification settings - Fork 771
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
Failure on `# type: ignore[code]' comments #108
Comments
Thanks for the suggestion. The use of "[code, ...]" after a "# type: ignore" comment is not part of the official spec, but it appears it's a variant supported by mypy. The error codes will not have any meaning outside of mypy, but we could treat it as a general "# type: ignore" (i.e. suppress all errors on the line) as specified in PEP 484. |
This change will be included in the next version of Pylance/Pyright. Thanks again for the suggestion. |
This issue has been fixed in version 2020.7.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202072-15-july-2020 |
I'm unable to get this to work, there's no squigly underline error indication when I add the following to a Python file opened in VSCode:
But the indication is displayed with the right error code when I remove the entire comment, so the code included in the brackets is having no effect. FWIW, this is also true when using Pyright seperately from Pylance. Environment data
|
As mentioned above, the bracket after the |
Environment data
Expected behaviour
# type: ignore[code]
treated same as# type: ignore
(or, at least, does not generate its own error)Actual behaviour
A line with e.g.
# type: ignore[attr-defined]
produces a number of errors:Note that
Type annotation not supported for this type of expression
is reported even ifpython.analysis.typeCheckingMode
isoff
.Code Snippet / Additional information
Mypy uses this syntax since 0.730 (python/mypy#7239). See e.g. PyCQA/pyflakes#455 and google/pytype#485 for other tools' changes to adapt to this syntax.
The text was updated successfully, but these errors were encountered: