Skip to content

Commit f59720d

Browse files
committed
Use refers_to_fullname to detect TYPE_CHECKING` usages.
1 parent 7031574 commit f59720d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypy/checker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5020,8 +5020,9 @@ def visit_if_stmt(self, s: IfStmt) -> None:
50205020
if_map, else_map = self.find_isinstance_check(e)
50215021

50225022
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")
5023+
refers_to_fullname(
5024+
e, ("typing.TYPE_CHECKING", "typing_extensions.TYPE_CHECKING")
5025+
)
50255026
):
50265027
if if_map is None:
50275028
if s.while_stmt:

0 commit comments

Comments
 (0)