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

Check tuples of abstract types #15366

Merged
merged 5 commits into from Jul 12, 2023
Merged

Check tuples of abstract types #15366

merged 5 commits into from Jul 12, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 4, 2023

The PR is quite simple (and I would like to keep it this way):

  • Before we were only checking type[] type
  • Now we also check tuple[type[], ...] type

There might be other types that we want to add in the future here: TypedDictType, etc?
But, let's do it one by one, because smaller PRs are easier to merge :)

Closes #15264

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@ikonst
Copy link
Contributor

ikonst commented Jun 12, 2023

First impression: shouldn't there be something else that recurses into a tuple already to validate types of items, so we could avoid teaching has_abstract_type_part about TupleType (and then about TypedDictType etc.) ?

@sobolevn
Copy link
Member Author

I don't see a clean way to do that.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 12, 2023

I don't see a clean way to do that.

What about just leaving a TODO comment about this, in case somebody figures out a good way to do that?

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.

Even if this doesn't fully solve the issue, this seems like a reasonably incremental improvement, though it would be good to add a comment explaining that this is incomplete (and perhaps why), as I mentioned in my other comment.

@sobolevn
Copy link
Member Author

@JukkaL thanks for the review! I've left a TODO note for future work :)
I will merge it once CI passes.

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@sobolevn sobolevn merged commit edb41e0 into master Jul 12, 2023
18 checks passed
@sobolevn sobolevn deleted the issue-15264 branch July 12, 2023 15:27
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.

False-negative type-abstract in dictionary initialization
3 participants