We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bug Report
I give my function a typed Callable, I get an error:
To Reproduce
def type_guard(x: Any, type_check_func: Callable[[Any], TypeGuard[T]]) -> T: if not type_check_func(x): raise TypeError("failed type assetion") return x def is_string(x: Any) -> TypeGuard[str]: return isinstance(x, str) data = "helloworld" val = type_guard(data, is_string)
Expected Behavior
Should not error
Actual Behavior
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var] Your Environment
The text was updated successfully, but these errors were encountered:
Still reproduces on 1.9.0: https://mypy-play.net/?mypy=latest&python=3.10&gist=bd80437034ccf2a3142a5dc74b1fb7b1
I imagine the code that produces that error doesn't know to look inside the TypeGuard. If so, this should be an easy fix.
Sorry, something went wrong.
Add TypeGuard and TypeIs traversing in TypeTraverserVisitor (#17071)
4a7e5d3
Fixes #17029.
Successfully merging a pull request may close this issue.
Bug Report
I give my function a typed Callable, I get an error:
To Reproduce
Expected Behavior
Should not error
Actual Behavior
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
Your Environment
The text was updated successfully, but these errors were encountered: