void () { doTestByText(""" from typing import Self, Callable class Shape: def difference(self, other: Self) -> float: ... def apply(self, f: Callable[[Self], None]) -> None: ... class Circle(Shape): pass def fCircle(c: Circle): pass def fShape(sh: Shape): pass sh = Shape() cir = Circle() sh.difference(cir) sh.difference(sh) cir.difference(cir) cir.difference(<warning descr="Expected type 'Circle' (matched generic type 'Self'), got 'Shape' instead">sh</warning>) cir.apply(fCircle) cir.apply(<warning descr="Expected type '(Circle) -> None' (matched generic type '(Self) -> None'), got '(sh: Shape) -> None' instead">fShape</warning>) sh.apply(fCircle) sh.apply(fShape)"""); }