File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1694,9 +1694,10 @@ def visit_dict_expr(self, e: DictExpr) -> Type:
1694
1694
1695
1695
Translate it into a call to dict(), with provisions for **expr.
1696
1696
"""
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
1700
1701
if isinstance (self .type_context [- 1 ], TypedDictType ):
1701
1702
self .check_typeddict_call_with_dict (
1702
1703
callee = self .type_context [- 1 ],
You can’t perform that action at this time.
0 commit comments