We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
redundant-expr
if TYPE_CHECKING
1 parent c387368 commit 7031574Copy full SHA for 7031574
mypy/checker.py
@@ -5019,7 +5019,10 @@ def visit_if_stmt(self, s: IfStmt) -> None:
5019
5020
if_map, else_map = self.find_isinstance_check(e)
5021
5022
- if codes.REDUNDANT_EXPR in self.options.enabled_error_codes:
+ if codes.REDUNDANT_EXPR in self.options.enabled_error_codes and not (
5023
+ isinstance(e, NameExpr)
5024
+ and e.fullname in ("typing.TYPE_CHECKING", "typing_extensions.TYPE_CHECKING")
5025
+ ):
5026
if if_map is None:
5027
if s.while_stmt:
5028
self.msg.redundant_condition_in_while(e)
0 commit comments