Skip to content

Conversation

KotlinIsland
Copy link
Contributor

@KotlinIsland KotlinIsland commented Sep 21, 2025

now broken (mypy)

_: list[int | str] = list[int]() + list[str]()

now fixed (mypy)

_: list[int | str] = list[str]() + list[str | int]()

now fixed (both):

_: list[object] = list[int]() + list[str]()

this break seems extremely minor (two cases in corpus), and it fixes pyright, so i think it's good

This comment has been minimized.

@KotlinIsland
Copy link
Contributor Author

why mypy primer, and not pyright? i don't really understand that

This comment has been minimized.

This comment has been minimized.

@KotlinIsland KotlinIsland marked this pull request as draft September 22, 2025 00:00
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spark (https://github.com/apache/spark)
+ python/pyspark/pandas/groupby.py:3696: error: Unsupported operand types for + ("list[Series[Any]]" and "list[Series[Any]]")  [operator]
+ python/pyspark/pandas/groupby.py:4142: error: Unused "type: ignore" comment  [unused-ignore]

freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/entryexitanalysis.py:285: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ freqtrade/data/entryexitanalysis.py:290: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ freqtrade/data/entryexitanalysis.py:296: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ freqtrade/data/entryexitanalysis.py:297: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

mypy (https://github.com/python/mypy)
+ mypyc/crash.py:29: error: Unsupported operand types for + ("list[FrameSummary]" and "list[FrameSummary]")  [operator]
+ mypyc/crash.py:29: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-operator for more info
+ mypy/strconv.py:454: error: Unsupported operand types for + ("list[Any]" and "list[Union[str, tuple[str, list[Any]]]]")  [operator]
+ mypy/errors.py:1343: error: Unsupported operand types for + ("list[FrameSummary]" and "StackSummary")  [operator]
+ mypy/fastparse.py:1624: error: Unsupported operand types for + ("list[expr]" and "list[expr]")  [operator]
+ mypy/test/testcmdline.py:77: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/type/validate.py:409: error: Unsupported operand types for + ("list[NamedTypeNode]" and "list[NamedTypeNode]")  [operator]
+ src/graphql/validation/rules/overlapping_fields_can_be_merged.py:89: error: Unsupported operand types for + ("list[FieldNode]" and "list[FieldNode]")  [operator]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/netutil.py:158: error: Incompatible types in assignment (expression has type "tuple[Any | int, ...]", variable has type "tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]")  [assignment]
+ tornado/autoreload.py:234: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

spack (https://github.com/spack/spack)
+ lib/spack/spack/environment/environment.py:1550: error: Incompatible return value type (got "tuple[list[Any], list[Any], list[tuple[Any, None] | tuple[Any, Any]]]", expected "tuple[list[Spec], list[Spec], list[tuple[Spec, Spec]]]")  [return-value]

sympy (https://github.com/sympy/sympy)
+ sympy/polys/galoistools.py:1753: error: Need type annotation for "Q"  [var-annotated]

core (https://github.com/home-assistant/core)
+ homeassistant/components/monzo/sensor.py:91: error: Unsupported operand types for + ("list[MonzoSensor]" and "list[MonzoSensor]")  [operator]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/ci_upload_heap_profiles.py:42: error: Unsupported operand types for + ("list[Any | str]" and "list[str]")  [operator]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/onboarding_steps.py:65: error: Unsupported operand types for + ("list[OneTimeNotice]" and "list[OneTimeAction]")  [operator]
+ zerver/lib/export.py:1718: error: Unsupported operand types for + ("list[dict[str, Any]]" and "list[dict[str, Any]]")  [operator]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/stata.py:1467: error: List comprehension has incompatible type List[object]; expected List[str | dtype[Any]]  [misc]
+ pandas/core/frame.py:11185: error: Incompatible return value type (got "DataFrame | Series | Any", expected "DataFrame")  [return-value]
+ pandas/core/groupby/ops.py:808: error: No overload variant of "unique" matches argument types "list[int]", "bool"  [call-overload]
+ pandas/core/groupby/ops.py:808: note: Possible overload variants:
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False] = ..., return_inverse: Literal[False] = ..., return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> ndarray[tuple[Any, ...], dtype[_ScalarT]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False] = ..., return_inverse: Literal[False] = ..., return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> ndarray[tuple[Any, ...], dtype[Any]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[True], return_inverse: Literal[False] = ..., return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[True], return_inverse: Literal[False] = ..., return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False], return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False] = ..., *, return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False], return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False] = ..., *, return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False], return_inverse: Literal[False], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False] = ..., return_inverse: Literal[False] = ..., *, return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False], return_inverse: Literal[False], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False] = ..., return_inverse: Literal[False] = ..., *, return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[True], return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[True], return_inverse: Literal[True], return_counts: Literal[False] = ..., axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[True], return_inverse: Literal[False], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[True], return_inverse: Literal[False] = ..., *, return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[True], return_inverse: Literal[False], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[True], return_inverse: Literal[False] = ..., *, return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False], return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[False] = ..., *, return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False], return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[False] = ..., *, return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def [_ScalarT: generic[Any]] unique(ar: _SupportsArray[dtype[_ScalarT]] | _NestedSequence[_SupportsArray[dtype[_ScalarT]]], return_index: Literal[True], return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/core/groupby/ops.py:808: note:     def unique(ar: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], return_index: Literal[True], return_inverse: Literal[True], return_counts: Literal[True], axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., sorted: bool = ...) -> tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit | _64Bit]]]]
+ pandas/tests/strings/conftest.py:6: error: Need type annotation for "_any_string_method"  [var-annotated]
+ pandas/tests/groupby/conftest.py:130: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ pandas/tests/frame/test_constructors.py:2318: error: Unsupported operand types for + ("list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]" and "list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]")  [operator]
+ pandas/tests/frame/test_constructors.py:2328: error: Unsupported operand types for + ("list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]" and "list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]")  [operator]
+ pandas/tests/arrays/test_datetimes.py:70: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ pandas/conftest.py:1632: error: Unsupported operand types for + ("list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]" and "list[ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object]]")  [operator]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/callables.py:579: error: Incompatible types in assignment (expression has type "list[None]", variable has type "list[Optional[expr]]")  [assignment]
- src/prefect/utilities/callables.py:579: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- src/prefect/utilities/callables.py:579: note: Consider using "Sequence" instead, which is covariant
- src/prefect/utilities/callables.py:581: error: Unsupported operand types for + ("list[None]" and "list[Optional[expr]]")  [operator]

pydantic (https://github.com/pydantic/pydantic)
- pydantic/aliases.py:29: error: Incompatible types in assignment (expression has type "list[str]", variable has type "list[int | str]")  [assignment]
- pydantic/aliases.py:29: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- pydantic/aliases.py:29: note: Consider using "Sequence" instead, which is covariant
- pydantic/aliases.py:29: error: Argument 1 to "list" has incompatible type "tuple[str | int, ...]"; expected "Iterable[str]"  [arg-type]

scipy (https://github.com/scipy/scipy)
+ scipy/fft/_pocketfft/tests/test_basic.py:473: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fft/_pocketfft/tests/test_basic.py:483: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fft/_pocketfft/tests/test_basic.py:502: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fft/_pocketfft/tests/test_basic.py:512: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fftpack/tests/test_basic.py:429: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fftpack/tests/test_basic.py:439: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fftpack/tests/test_basic.py:458: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/fftpack/tests/test_basic.py:468: error: Unsupported operand types for + ("list[int]" and "list[int]")  [operator]
+ scipy/optimize/tests/test_optimize.py:1289: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/scripts/gettext.py:54:70: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/utils/universal.py:2365:87: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/cmake/interpreter.py:1069:69: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/cmake/interpreter.py:1213:60: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ run_mypy.py:154:62: error: Unsupported operand types for + ("list[Any | str]" and "list[str]")  [operator]
+ mesonbuild/modules/i18n.py:165:43: error: Unsupported operand types for + ("list[File]" and "list[CustomTarget]")  [operator]
+ mesonbuild/modules/gnome.py:1560:23: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/modules/gnome.py:1577:77: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/depfixer.py:436:66: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:62:40: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:73:40: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:83:35: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:120:35: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:128:35: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:134:59: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:140:64: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:147:64: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:156:47: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/scripts/coverage.py:172:40: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/modules/_qt.py:453:114: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/modules/_qt.py:474:126: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/modules/_qt.py:872:86: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/modules/_qt.py:916:173: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]
+ mesonbuild/mtest.py:2250:47: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/config/cc_mounts.py:420: error: Incompatible return value type (got "list[list[Any | str | None]]", expected "list[list[str]]")  [return-value]

paasta (https://github.com/yelp/paasta)
+ paasta_tools/config_utils.py:101: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/qemu.py:446:22: error: Unsupported operand types for + ("list[str]" and "list[str]")  [operator]

@KotlinIsland KotlinIsland marked this pull request as ready for review September 22, 2025 02:11
@srittau
Copy link
Collaborator

srittau commented Sep 22, 2025

As the primer output shows, this breaks a lot of stuff. While we try to reduce the amount of type checker workarounds, the impact of this change is too high for it to be accepted into typeshed.

@srittau srittau closed this Sep 22, 2025
@KotlinIsland
Copy link
Contributor Author

@srittau can you please un-close this so i can keep experimenting

@AlexWaygood
Copy link
Member

Consider making a PR against your own fork if you want to experiment with the ecosystem impact of possible changes — you can get a mypy_primer run in the same way as making a PR against the upstream typeshed repo, but it saves the typeshed maintainers getting repeated notifications for PRs where you're not yet looking for a review :-)

@KotlinIsland
Copy link
Contributor Author

Consider making a PR against your own fork if you want to experiment with the ecosystem impact of possible changes — you can get a mypy_primer run in the same way as making a PR against the upstream typeshed repo, but it saves the typeshed maintainers getting repeated notifications for PRs where you're not yet looking for a review :-)

thanks, it was draft the whole time

@AlexWaygood
Copy link
Member

Well, srittau only closed it after you explicitly marked it as ready for review :-)

Screenshot_20250923_084057_Firefox

But regardless, I have notifications switched on for all activity on the typeshed repo, which includes notifications for activity on draft PRs, and I'd imagine other maintainers might have similar settings enabled :-)

@KotlinIsland
Copy link
Contributor Author

KotlinIsland commented Sep 23, 2025

how does this look? @srittau @AlexWaygood

Diff from mypy_primer, showing the effect of this PR on open source code:

zulip (https://github.com/zulip/zulip)
+ zerver/lib/onboarding_steps.py:65: error: Unsupported operand types for + ("list[OneTimeNotice]" and "list[OneTimeAction]")  [operator]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/callables.py:579: error: Incompatible types in assignment (expression has type "list[None]", variable has type "list[Optional[expr]]")  [assignment]
- src/prefect/utilities/callables.py:579: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- src/prefect/utilities/callables.py:579: note: Consider using "Sequence" instead, which is covariant
- src/prefect/utilities/callables.py:581: error: Unsupported operand types for + ("list[None]" and "list[Optional[expr]]")  [operator]

pydantic (https://github.com/pydantic/pydantic)
- pydantic/aliases.py:29: error: Incompatible types in assignment (expression has type "list[str]", variable has type "list[int | str]")  [assignment]
- pydantic/aliases.py:29: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- pydantic/aliases.py:29: note: Consider using "Sequence" instead, which is covariant
- pydantic/aliases.py:29: error: Argument 1 to "list" has incompatible type "tuple[str | int, ...]"; expected "Iterable[str]"  [arg-type]

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/modules/i18n.py:165:43: error: Unsupported operand types for + ("list[File]" and "list[CustomTarget]")  [operator]

@AlexWaygood
Copy link
Member

That looks potentially quite promising

@KotlinIsland

This comment was marked as resolved.

@KotlinIsland

This comment was marked as resolved.

@KotlinIsland

This comment was marked as resolved.

@KotlinIsland
Copy link
Contributor Author

@AlexWaygood could you please re-open this? i just feel that i'll forget it exists if it's closed, and i don't want it to get lost

@AlexWaygood
Copy link
Member

no, I can't:

image

@KotlinIsland
Copy link
Contributor Author

no, I can't:

thanks, I'll just open a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants