-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
Description
Bug Report
Regression from 1.6.1 to 1.7: when passing a simple covariant type through a builtin (like sorted) the return type becomes a wider generic based type.
To Reproduce
def foo(a: list[int] | list[str]) -> list[int] | list[str]:
return sorted(a)
Expected Behavior
running mypy on the simple code above produces no error in 1.6.1.
Actual Behavior
error: Incompatible return value type (got "list[SupportsDunderLT[Any] | SupportsDunderGT[Any]]", expected "list[int] | list[str]") [return-value]
Your Environment
Regression from 1.6.1 to 1.7.0. Seen on multiple python versions (3.10, 3.11)