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
Mypy does not seem to recognize concretized type for a generic in its method's self.
To Reproduce
from typing import Callable, Generic, TypeVar from typing_extensions import ParamSpec, Concatenate, Self from unittest.mock import Mock P = ParamSpec("P") R = TypeVar("R") class Check(Generic[P, R]): def check(self) -> None: pass class Shall( Generic[P, R]): def __init__(self, callable: Callable[P, R]) -> None: pass def suchThat(self, other: Callable[Concatenate[R, P], bool]) -> Self: return self def check(returnValue: None, other: Check[[int],str] ) -> bool: return True Shall[[Check[[int],str]],None](Check[[int],str].check).suchThat(check)
https://mypy-play.net/?mypy=master&python=3.9&gist=0f2967cc8cff879cdfcc8280b7fca53c
Expected Behavior
No error
Actual Behavior
main.py:25: error: Argument 1 to "Shall" has incompatible type "Callable[[Check[P, R]], None]"; expected "Callable[[Check[[int], str]], None]" [arg-type]
mypy.ini
[mypy] strict = True explicit_package_bases = True namespace_packages = True #mypy_path = src:test files = src,test mypy_path = $MYPY_CONFIG_FILE_DIR/src:$MYPY_CONFIG_FILE_DIR/test
The text was updated successfully, but these errors were encountered:
Even smaller reproduction:
from typing import Callable, Generic, TypeVar from typing_extensions import ParamSpec, Concatenate, Self from unittest.mock import Mock P = ParamSpec("P") R = TypeVar("R") class Check(Generic[P, R]): def check(self) -> None: pass class Shall( Generic[P, R]): def __init__(self, callable: Callable[P, R]) -> None: pass Shall[[Check[[int],str]],None](Check[[int],str].check)
https://mypy-play.net/?mypy=master&python=3.9&gist=4ed820cd660f49a4f7f3d800054576aa
Sorry, something went wrong.
Beginnig of check contract, marked ignores with the corresponding myp…
13ea527
…y bug python/mypy#14806 8 times python/mypy#14785 2 times
No branches or pull requests
Bug Report
Mypy does not seem to recognize concretized type for a generic in its method's self.
To Reproduce
https://mypy-play.net/?mypy=master&python=3.9&gist=0f2967cc8cff879cdfcc8280b7fca53c
Expected Behavior
No error
Actual Behavior
main.py:25: error: Argument 1 to "Shall" has incompatible type "Callable[[Check[P, R]], None]"; expected "Callable[[Check[[int], str]], None]" [arg-type]
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: