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

Changes how TypeGuard types are checked in subtypes #11314

Merged
merged 3 commits into from
Oct 30, 2021
Merged

Changes how TypeGuard types are checked in subtypes #11314

merged 3 commits into from
Oct 30, 2021

Conversation

sobolevn
Copy link
Member

Now two functions are not considered subtypes if:

  1. First returns TypeGuard, other returns bool. We respect subtyping direction here. TypeGuard is considered to be subtype of bool
  2. First returns TypeGuard[int], second returns TypeGuard[str]

Closes #11307

Copy link
Member Author

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks! Now it should be ready.

test-data/unit/check-typeguard.test Show resolved Hide resolved
test-data/unit/check-typeguard.test Show resolved Hide resolved
@hauntsaninja hauntsaninja merged commit 47d2ea5 into python:master Oct 30, 2021
@hauntsaninja
Copy link
Collaborator

Thank you!

@sobolevn
Copy link
Member Author

Thanks everyone!

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.

bool and TypeGuard incorrect match in @overload method
3 participants