Closed Rawalanche closed 6 months ago
This behavior is intended. Type annotations are used for type analysis regardless of whether you're interested in static type checking. Therefore, it's important for type annotations, if present, to use correct expression forms. Your code is using an expression form that is illegal for type annotations. This problem impacts all type evaluations and will likely affect your experience with code completions, etc. For that reason, it's important to warn you about the problem regardless of whether other static type checking errors are reported.
You can manually disable all reportInvalidTypeForm
diagnostics if you would like, but I recommend against it. It's better if you correct the problems in your code and use type annotations in accordance with the Python typing spec.
For a full list of default diagnostic severities, refer to this documentation. Note that several diagnostic rules are set to "warning" severity even if the type checking mode is set to "off".
This behavior is intended. Type annotations are used for type analysis regardless of whether you're interested in static type checking. Therefore, it's important for type annotations, if present, to use correct expression forms. Your code is using an expression form that is illegal for type annotations. This problem impacts all type evaluations and will likely affect your experience with code completions, etc. For that reason, it's important to warn you about the problem regardless of whether other static type checking errors are reported.
You can manually disable all
reportInvalidTypeForm
diagnostics if you would like, but I recommend against it. It's better if you correct the problems in your code and use type annotations in accordance with the Python typing spec.For a full list of default diagnostic severities, refer to this documentation. Note that several diagnostic rules are set to "warning" severity even if the type checking mode is set to "off".
I wish I could do something better about it, but I can't unfortunately. This syntax is mandatory in Blender's python API, and Blender is the largest, most popular open source 3D modeling/editing software. I don't know who's at wrong here, but I don't have any better choice than to turn these warnings off and bury my head in the sand :/
@Rawalanche, also see the discussion in https://github.com/microsoft/pylance-release/issues/5457.
Pylance reportInvalidTypeForm warnings appear in the VSCode problems list despite type checking being completely disabled:
"python.analysis.diagnosticSeverityOverrides": {"reportInvalidTypeForm": "none"} does work to solve the problem but I don't understand how this can have any effect when it's preceded by "python.analysis.typeCheckingMode": "off"
Code Snippet
Repro Steps
Expected behavior
Type checking warnings do not appear in the Problems list because type checking is disabled
Actual behavior
Type checking warnings appear in the Problems list despite type checking being disabled