由于在通用类中记录了协议符合性检查,导致依赖于订单的过载解析失败
作者: cmp0xff创建于 2026年8月15日更新于 2026年8月24日
标签bugaddressed in next version
T_contra = TypeVar("T_contra", contravariant=True) T = TypeVar("T") S = TypeVar("S") S_contra = TypeVar("S_contra", contravariant=True)
class ElementOpsMixin(Generic[S]): @overload def _proto_add(self: "ElementOpsMixin[bool]", other: bool, /) -> "ElementOpsMixin[bool]": ... @overload def _proto_add(self: "ElementOpsMixin[int]", other: int, /) -> "ElementOpsMixin[int]": ... def _proto_add(self, other: object, /) -> object: return self
内容来源: microsoft/pyright