Skip to content

Commit 131eef2

Browse files
committed
Only check if we received Any?
1 parent 934976d commit 131eef2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypy/checkexpr.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,12 @@ def analyze_ref_expr(self, e: RefExpr, lvalue: bool = False) -> Type:
401401
result = node.type
402402
elif isinstance(node, (FuncDef, TypeInfo, TypeAlias, MypyFile, TypeVarLikeExpr)):
403403
result = self.analyze_static_reference(node, e, e.is_alias_rvalue or lvalue)
404-
if isinstance(node, TypeInfo) and has_deferred_constructor(node):
404+
if (
405+
isinstance(node, TypeInfo)
406+
and isinstance(result, ProperType)
407+
and isinstance(result, AnyType)
408+
and has_deferred_constructor(node)
409+
):
405410
# When __init__ or __new__ is wrapped in a custom decorator, we need to defer.
406411
# analyze_static_reference guarantees that it never defers, so play along.
407412
self.chk.handle_cannot_determine_type(node.name, e)

0 commit comments

Comments
 (0)