void () { doTestByText(""" from typing import Self, Callable class MyClass: def foo(self, bar: Self) -> Self: ... class SubClass(MyClass): pass myClass = MyClass() subClass = SubClass() myClass.foo(myClass.foo(myClass)) myClass.foo(subClass.foo(subClass)) myClass.foo(myClass.foo(subClass)) myClass.foo(subClass.foo(<warning descr="Expected type 'SubClass' (matched generic type 'Self'), got 'MyClass' instead">myClass</warning>)) subClass.foo(<warning descr="Expected type 'SubClass' (matched generic type 'Self'), got 'MyClass' instead">myClass.foo(myClass)</warning>) subClass.foo(subClass.foo(subClass)) subClass.foo(<warning descr="Expected type 'SubClass' (matched generic type 'Self'), got 'MyClass' instead">myClass.foo(subClass)</warning>) subClass.foo(subClass.foo(<warning descr="Expected type 'SubClass' (matched generic type 'Self'), got 'MyClass' instead">myClass</warning>))"""); }