8000 Add comment · python/mypy@c0c9bfe · GitHub
[go: up one dir, main page]

Skip to content

Commit c0c9bfe

Browse files
committed
Add comment
1 parent f19eb1e commit c0c9bfe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mypy/checkexpr.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,9 +1694,10 @@ def visit_dict_expr(self, e: DictExpr) -> Type:
16941694
16951695
Translate it into a call to dict(), with provisions for **expr.
16961696
"""
1697-
# if we find a DictExpr inside a context that expected TypedDict,
1698-
# we try to convert the dictionary into TypedDict
1699-
# we warn if they are not compatible or if we don't have enough info to verify
1697+
# if the dict literal doesn't match TypedDict, check_typeddict_call_with_dict reports
1698+
# an error, but returns the TypedDict type that matches the literal it found
1699+
# that would cause a second error when that TypedDict type is returned upstream
1700+
# to avoid the second error, we always return TypedDict type that was requested
17001701
if isinstance(self.type_context[-1], TypedDictType):
17011702
self.check_typeddict_call_with_dict(
17021703
callee=self.type_context[-1],

0 commit comments

Comments
 (0)
0