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

Add TypeGuard and TypeIs traversing in TypeTraverserVisitor (fixes #17029) #17071

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

sloboegen
Copy link
Contributor

Fixes #17029.

Comment on lines +89 to +90
if t.type_guard is not None:
t.type_guard.accept(self)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this an issue for TypeIs as well? Probably as easy as adding an if t.type_is is not None clause here.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please add an analogous test for TypeIs as well. It should behave exactly the same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks! It was interesting to learn about TypeIs :)

This comment has been minimized.

@sloboegen sloboegen changed the title Add TypeGuard traversing in TypeTraverserVisitor (fixes #17029) Add TypeGuard and TypeIs traversing in TypeTraverserVisitor (fixes #17029) Mar 28, 2024
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

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

@hauntsaninja hauntsaninja merged commit 4a7e5d3 into python:master Mar 29, 2024
18 checks passed
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.

A callable typed function is not recognised as a TypeVar-ed argument
4 participants