KEMBAR78
Better error message for nested TypedDict by 97littleleaf11 · Pull Request #11658 · python/mypy · GitHub
Skip to content

Conversation

97littleleaf11
Copy link
Collaborator

Description

Closes #4299

Test Plan

Add a new test case testCannotCreateTypedDictInstanceWithInlineTypedDict

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left one idea about tweaking the error message (optional). Feel free to merge.

isinstance(field_type_expr.callee, RefExpr) and
field_type_expr.callee.fullname in TPDICT_NAMES):
self.fail_typeddict_arg(
'Inline TypedDict types not supported; use assignment',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding: What about making this more detailed, such as like this:

Inline TypedDict types not supported; use assignment to define TypedDict

@97littleleaf11 97littleleaf11 merged commit 872bc86 into python:master Dec 3, 2021
@97littleleaf11 97littleleaf11 deleted the fix-4299 branch December 3, 2021 11:31
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better message for nested TypedDict

2 participants