void () { doTestByText(""" from __future__ import annotations from typing import Self, Protocol class MyProtocol(Protocol): def foo(self, bar: float) -> Self: ... class MyClass: def foo(self, bar: float) -> MyClassNotSubclass: pass class MyClassNotSubclass: def foo(self, bar: float) -> int: pass def accepts_protocol(obj: MyProtocol) -> None: print(obj) obj = MyClass() accepts_protocol(<warning descr="Expected type 'MyProtocol', got 'MyClass' instead">obj</warning>) """); }