Closed
Description
Bug Report
If I have a generic class with an attribute of a generic type, when creating a concrete subclass, overriding that attribute with a correctly typed property raises an error. Similar to #4125
To Reproduce
from typing import TypeVar, Generic
T = TypeVar("T")
class A(Generic[T]):
def __init__(self, val: T):
self.member: T = val
class B(A[str]):
@property
def member(self) -> str:
return "bar"
@member.setter
def member(self, val: str):
pass
Actual Behavior
property_issue.py:10: error: Signature of "member" incompatible with supertype "A" [override]
property_issue.py:10: note: Superclass:
property_issue.py:10: note: T
property_issue.py:10: note: Subclass:
property_issue.py:10: note: str
Your Environment
- Mypy version used: 1.9.0
- Mypy command-line flags: -
- Mypy configuration options from
mypy.ini
(and other config files): - - Python version used: 3.9.13