mirror of https://github.com/astral-sh/ruff
callable invariance rears its head again
This commit is contained in:
parent
a372e63b2c
commit
d47e9a60df
|
|
@ -478,7 +478,8 @@ class C[**P]:
|
||||||
def __init__(self, f: Callable[P, int]) -> None:
|
def __init__(self, f: Callable[P, int]) -> None:
|
||||||
self.f = f
|
self.f = f
|
||||||
|
|
||||||
def f(x: int, y: str) -> bool:
|
# Note that the return type must match exactly, since C is invariant on the return type of C.f.
|
||||||
|
def f(x: int, y: str) -> int:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
c = C(f)
|
c = C(f)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue