Closed as not planned
Description
Bug Report
Consider the following snippet:
from typing import Generic, TypeVar
T = TypeVar("T")
class Base(Generic[T]):
def f(self) -> _T: ...
class Child(Base[bool]):
...
# Following three lines demonstrate two issues:
# - `T` was never filled in.
# - The return type became `Any`.
# test.py:21: note: Revealed type is "def (self: a.Base[T`1]) -> Any"
# test.py:22: note: Revealed type is "def [T] (self: a.Base[T`1]) -> Any"
# test.py:23: note: Revealed type is "def (self: a.Base[T`1]) -> Any"
reveal_type(Child.f)
reveal_type(Base.f) # In this case, probably expected.
reveal_type(Base[int].f)
# When calling the unbound method, the return type is `Any`.
unbound_method = Child.f
x = unbound_method(Base())
reveal_type(x) # Any.
Expected Behavior
I'd expect the typevar to be replaced.
Your Environment
- Mypy version used: 0.982
- Python version used: 3.9.13