diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi index 6e983ef9ef29..9057d4ad34b7 100644 --- a/mypy/typeshed/stdlib/builtins.pyi +++ b/mypy/typeshed/stdlib/builtins.pyi @@ -241,6 +241,8 @@ _NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, - _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed class int: + @overload + def __new__(cls, /) -> Literal[0]: ... @overload def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ... @overload @@ -458,6 +460,8 @@ class _TranslateTable(Protocol): def __getitem__(self, key: int, /) -> str | int | None: ... class str(Sequence[str]): + @overload + def __new__(cls) -> Literal[""]: ... @overload def __new__(cls, object: object = ...) -> Self: ... @overload @@ -834,6 +838,9 @@ class memoryview(Sequence[_I]): @final class bool(int): + @overload + def __new__(cls, /) -> Literal[False]: ... + @overload def __new__(cls, o: object = ..., /) -> Self: ... # The following overloads could be represented more elegantly with a TypeVar("_B", bool, int), # however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).