File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1962,6 +1962,9 @@ def check_reverse_op_method(
19621962
19631963 assert defn .info
19641964
1965+ if defn .info .is_protocol :
1966+ return
1967+
19651968 # First check for a valid signature
19661969 method_type = CallableType (
19671970 [AnyType (TypeOfAny .special_form ), AnyType (TypeOfAny .special_form )],
Original file line number Diff line number Diff line change @@ -1539,6 +1539,17 @@ f(C()) # E: No overload variant of "f" matches argument type "C" \
15391539[builtins fixtures/isinstance.pyi]
15401540[typing fixtures/typing-full.pyi]
15411541
1542+ [case testProtocolReversePowWithModulo]
1543+ from typing import overload, Protocol
1544+
1545+ class PowableProto(Protocol):
1546+ @overload
1547+ def __rpow__(self, other: "PowableProto") -> "PowableProto": ...
1548+ @overload
1549+ def __rpow__(
1550+ self, other: "PowableProto", modulo: "PowableProto"
1551+ ) -> "PowableProto": ...
1552+
15421553-- Unions of protocol types
15431554-- ------------------------
15441555
You can’t perform that action at this time.
0 commit comments