@@ -3886,3 +3886,44 @@ def a4(x: List[str], y: List[Never]) -> None:
38863886 reveal_type(z2) # N: Revealed type is "builtins.list[builtins.object]"
38873887 z1[1].append("asdf") # E: "object" has no attribute "append"
38883888[builtins fixtures/dict.pyi]
3889+
3890+
3891+ [case testNonDeterminismFromNonCommuativeJoinInvolvingProtocolBaseAndPromotableType]
3892+ # flags: --python-version 3.11
3893+ # Regression test for https://github.com/python/mypy/issues/16979#issuecomment-1982246306
3894+ from __future__ import annotations
3895+
3896+ from typing import Any, Generic, Protocol, TypeVar, overload, cast
3897+ from typing_extensions import Never
3898+
3899+ T = TypeVar("T")
3900+ U = TypeVar("U")
3901+
3902+ class _SupportsCompare(Protocol):
3903+ def __lt__(self, other: Any, /) -> bool:
3904+ return True
3905+
3906+ class Comparable(_SupportsCompare):
3907+ pass
3908+
3909+ class A(Generic[T, U]):
3910+ @overload
3911+ def __init__(self: A[T, T], a: T, b: T, /) -> None: ... # type: ignore[overload-overlap]
3912+ @overload
3913+ def __init__(self: A[T, U], a: T, b: U, /) -> Never: ...
3914+ def __init__(self, *a) -> None: ...
3915+
3916+ comparable: Comparable = Comparable()
3917+
3918+ from typing import _promote
3919+
3920+ class floatlike:
3921+ def __lt__(self, other: floatlike, /) -> bool: ...
3922+
3923+ @_promote(floatlike)
3924+ class intlike:
3925+ def __lt__(self, other: intlike, /) -> bool: ...
3926+
3927+ reveal_type(A(intlike(), comparable)) # N: Revealed type is "__main__.A[__main__._SupportsCompare, __main__._SupportsCompare]"
3928+ [builtins fixtures/tuple.pyi]
3929+ [typing fixtures/typing-medium.pyi]
0 commit comments