Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for nested TypedDict #11658

Merged
merged 3 commits into from
Dec 3, 2021

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