Skip to content

Commit 8882c80

Browse files
committed
Return early for dict if already deferred
1 parent 3aa9472 commit 8882c80

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mypy/checkexpr.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5275,9 +5275,15 @@ def fast_dict_type(self, e: DictExpr) -> Type | None:
52755275
ctx = self.type_context[-1]
52765276
if ctx:
52775277
return None
5278+
5279+
if self.chk.current_node_deferred:
5280+
# Guarantees that all items will be Any, we'll reject it anyway.
5281+
return None
5282+
52785283
rt = self.resolved_type.get(e, None)
52795284
if rt is not None:
52805285
return rt if isinstance(rt, Instance) else None
5286+
52815287
keys: list[Type] = []
52825288
values: list[Type] = []
52835289
stargs: tuple[Type, Type] | None = None

0 commit comments

Comments
 (0)