Skip to content

Commit c8ae0e9

Browse files
committed
Move get_proper_type section into try block with lookup_qualified
1 parent d72f74b commit c8ae0e9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mypy/checkexpr.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,15 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
558558
else:
559559
try:
560560
node = self.chk.lookup_qualified(e.args[0].name)
561+
if node:
562+
if isinstance(node.node, TypeAlias):
563+
# Resolve type
564+
typ = get_proper_type(node.node.target)
565+
else:
566+
typ = node.node.type
561567
except KeyError:
562568
# Undefined names should already be reported in semantic analysis.
563569
pass
564-
if node:
565-
if isinstance(node.node, TypeAlias):
566-
# Resolve type
567-
typ = get_proper_type(node.node.target)
568-
else:
569-
typ = node.node.type
570570
if (
571571
typ is not None
572572
and isinstance(typ, UnionType)

0 commit comments

Comments
 (0)