KEMBAR78
Add TypeGuard and TypeIs traversing in TypeTraverserVisitor (fixes #17029) by sloboegen · Pull Request #17071 · python/mypy · GitHub
Skip to content

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 :)

@github-actions

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!

@github-actions
Copy link
Contributor

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

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