warn unused ignores flag does not respect TYPE_CHECKING #14365
Labels
bug
mypy got something wrong
topic-reachability
Detecting unreachable code
topic-type-ignore
# type: ignore comments
Bug Report
With
pandas-stubs
, we are usingpyright
andmypy
. We have code that we want to test withpyright
, but notmypy
because of amypy
bug. We are using thealways-true
option, but the issue here can be shown usingTYPE_CHECKING
.If you include the flag
--warn-unused-ignores
, then the warnings will occur on code that should not be checked if looking at constants likeTYPE_CHECKING
or those set byalways-true
.To Reproduce
Using
mypy --no-incremental --warn-unused-ignores ignoretst.py
, you get the error:Expected Behavior
No warning reported.
Actual Behavior
See above - even though the code should NOT be type checked, you are getting a warning.
Your Environment
--no-incremental --warn-unused-ignores
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: