BSK-E0077
error
Protocol Self-return conformance violation
When a Protocol declares a method returning Self, any class passed where that protocol is expected must have the corresponding method return Self or the class itself. If the method returns a completely different type (e.g. int or a different class), the class does not satisfy the protocol.
class ShapeProtocol(Protocol):
def set_scale(self, scale: float) -> Self: ...
class BadReturn:
def set_scale(self, scale: float) -> int:
return 42
def accepts(s: ShapeProtocol) -> None: ...
def main(bad: BadReturn) -> None:
accepts(bad) # E — BadReturn.set_scale returns int, not Self
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0077 down per-file or per-path from your editor or
pyproject.toml, or fix the code
so it type-checks. See the Type System rules and
the complete diagnostic reference.
Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0077