`BoundMethod[ReLU, (...) -> Any]` is not assignable to `BoundMethod[ReLU, (self: ReLU, arg: Tensor, /) -> Tensor]`
Describe the Bug
from typing import Any, Callable, Protocol, reveal_type
class Tensor: ...
class Module:
def _wrapped_call_impl(self, *args: Any, **kwargs: Any) -> Any: ...
__call__: Callable[..., Any] = _wrapped_call_impl
class ReLU(Module): ...
class Activation(Protocol):
def __call__(self, arg: Tensor, /) -> Tensor: ...
cls: type[Activation] = ReLU
reveal_type(ReLU.__call__)
Python: 3.12
This example errors:
ERROR sandbox.py:15:25-29: `type[ReLU]` is not assignable to `type[Activation]` [[bad-assignment](https://pyrefly.org/en/docs/error-kinds/#bad-assignment)]
`ReLU.__call__` has type `BoundMethod[ReLU, (...) -> Any]`, which is not assignable to `BoundMethod[ReLU, (self: ReLU, arg: Tensor, /) -> Tensor]`, the type of `Activation.__call__`
However, Callable[..., Any] should be compatible with any callable signature. (it's essentially a gradual type like Any, but restricted to callables).
Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABAE7wCuUALgBQCUNAtAHw1gouVC0Q1CEgDrppMOnQD6AN1RQ4NALw0A2gF1pYXHRoKaEdPQwBzGGwCMABgcdE0mu5pzFKtYVTFiGCw2Bjhmdg4OaVQlK00aMIBbNi9lVTguAHoaWHQU%2BTS1KPQQABoQRhZoOBJyRBAAYhoAVSqoCBZSAUZ0AGMq3HQ4aWkqWkM6RJEFdEZE7Dk2fDFzFi4%2BBJY6VwsPBhZGOgswSRAAOTmF7ZpgfABfU%2BkykDIGQVJCFlxEqAomgAVSG8oF00Fg8PgaL1BpArIcRBBBoRpE0AMowGA0AAWLBYxDgiEymVe1BBhCMVkyQUymFwvTgmWh6Fh8IG6GyExoMVQ0FQ2FgUJhEDhdARgxouGIbJq0jILCxg24SjkcERFi0pwAzIQ7AAmR4lO7lVD9CDKgBi0BgFDBOAItRAdyAA
(Only applicable for extension issues) IDE Information
No response
Thanks for the bug report!