Open
Description
Bug Report
mypy fails to proceed sorting of the empty list, considering it's a list[object]
, see the reproduce script and the output
To Reproduce
a: list[str] | list[int] = []
a = sorted(a)
Expected Behavior
There shouldn't be errors
Actual Behavior
> mypy .
/tmp/test.py:2: error: Incompatible types in assignment (expression has type "list[SupportsDunderLT[Any] | SupportsDunderGT[Any]]", variable has type "list[str] | list[int]") [assignment]
Your Environment
- Mypy version used:
mypy 1.14.0 (compiled: no)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.13.2
In the scope of ClickHouse/ClickHouse#76679