Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,7 @@ def check_funcdef_item(
if (
defn.info
and self.is_reverse_op_method(name)
and not defn.info.is_protocol
and defn not in self.overload_impl_stack
):
# TODO: we should use decorated signature for this check.
Expand Down
9 changes: 9 additions & 0 deletions test-data/unit/check-protocols.test
Original file line number Diff line number Diff line change
Expand Up @@ -4809,3 +4809,12 @@ bad_rep(t) # E: Argument 1 to "bad_rep" has incompatible type "C"; expected "P[
# N: Got: \
# N: def rep(self) -> C
[builtins fixtures/tuple.pyi]

[case testProtocolTernaryRpow]
from typing import Protocol

class PowableProto(Protocol):
def __pow__(self, other: "PowableProto", modulo: "PowableProto") -> "PowableProto":
...
def __rpow__(self, other: "PowableProto", modulo: "PowableProto") -> "PowableProto":
...
Loading