basedmypy
basedmypy copied to clipboard
`unsafe-variance` error appears on the getter return type instead of the setter input parameter when covariant generic is used with inferred setter input type
Describe the problem, ie expected/actual result (if it's not blatantly obvious)
expected
class Foo(Generic[T_co]):
@property
def foo(self) -> T_co:
...
@foo.setter
def foo(self, value): # error: unsafe-variance
...
actual
class Foo(Generic[T_co]):
@property
def foo(self) -> T_co: # error: unsafe-variance
...
@foo.setter
def foo(self, value):
...
Gist to reproduce
from typing import Generic
from basedtyping import T_co
class Foo(Generic[T_co]):
@property
def foo(self) -> T_co:
...
@foo.setter
def foo(self, value):
...
Basedmypy version
1.4.0
Command-line flags
No response
Configuration options from pyproject.toml (and other config files)
No response
Python version used
3.10
Operating system and version
windows 10