Skip to content

[ty] Promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position.#24705

Draft
lerebear wants to merge 1 commit intomainfrom
lerebear/push-trkuowqxsnyq
Draft

Conversation

@lerebear
Copy link
Copy Markdown
Contributor

Summary

Closes astral-sh/ty#2620.

Test Plan

Please see new and updated mdtests.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 18, 2026
@lerebear lerebear changed the title Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Promote unions of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 18, 2026
@lerebear lerebear changed the title Promote unions of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 18, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.36%. The number of fully passing files held steady at 79/133.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

Memory usage report

Summary

Project Old New Diff Outcome
sphinx 262.78MB 262.86MB +0.03% (83.56kB)
prefect 718.20MB 718.23MB +0.00% (29.51kB)
flake8 47.94MB 47.95MB +0.02% (8.25kB)
trio 117.65MB 117.65MB +0.00% (540.00B)

Significant changes

Click to expand detailed breakdown

sphinx

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 2.04MB 2.07MB +1.44% (30.10kB)
infer_expression_types_impl 20.76MB 20.77MB +0.05% (9.62kB)
Specialization 1.02MB 1.03MB +0.91% (9.52kB)
GenericAlias 444.16kB 450.28kB +1.38% (6.12kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 471.66kB 477.63kB +1.27% (5.98kB)
TupleType<'db>::to_class_type_ 158.24kB 164.16kB +3.74% (5.92kB)
is_redundant_with_impl 1.49MB 1.49MB +0.34% (5.14kB)
is_redundant_with_impl::interned_arguments 1.73MB 1.73MB +0.28% (4.98kB)
UnionType 1.07MB 1.07MB +0.14% (1.52kB)
function_known_decorators 2.46MB 2.46MB +0.05% (1.36kB)
infer_deferred_types 5.53MB 5.53MB +0.02% (1.36kB)
IntersectionType 688.13kB 689.12kB +0.14% (1008.00B)
infer_definition_types 23.63MB 23.63MB +0.00% (876.00B)
infer_scope_types_impl 15.43MB 15.43MB +0.00% (108.00B)

prefect

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 4.81MB 4.81MB +0.20% (10.03kB)
function_known_decorators 8.28MB 8.28MB +0.06% (5.30kB)
infer_deferred_types 14.62MB 14.63MB +0.04% (5.25kB)
Specialization 2.28MB 2.28MB +0.12% (2.83kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 1.16MB 1.16MB +0.17% (1.97kB)
GenericAlias 1016.16kB 1017.91kB +0.17% (1.76kB)
TupleType<'db>::to_class_type_ 505.14kB 505.96kB +0.16% (844.00B)
infer_definition_types 90.56MB 90.56MB +0.00% (768.00B)
infer_expression_types_impl 63.14MB 63.14MB +0.00% (468.00B)
infer_scope_types_impl 54.93MB 54.93MB +0.00% (240.00B)
UnionType 3.01MB 3.01MB +0.00% (112.00B)

flake8

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 319.72kB 323.22kB +1.09% (3.50kB)
Specialization 161.30kB 162.39kB +0.68% (1.09kB)
function_known_decorators 319.14kB 319.94kB +0.25% (816.00B)
infer_deferred_types 693.74kB 694.54kB +0.11% (816.00B)
StaticClassLiteral<'db>::try_mro_::interned_arguments 72.63kB 73.34kB +0.97% (720.00B)
GenericAlias 70.95kB 71.65kB +0.99% (720.00B)
TupleType<'db>::to_class_type_ 15.52kB 15.93kB +2.67% (424.00B)
infer_definition_types 1.86MB 1.86MB +0.01% (156.00B)
infer_expression_types_impl 1.04MB 1.04MB +0.01% (96.00B)

trio

Name Old New Diff Outcome
infer_expression_types_impl 7.01MB 7.01MB +0.00% (324.00B)
infer_definition_types 7.58MB 7.58MB +0.00% (120.00B)
infer_scope_types_impl 4.75MB 4.75MB +0.00% (48.00B)
function_known_decorators 922.48kB 922.50kB +0.00% (24.00B)
infer_deferred_types 2.34MB 2.34MB +0.00% (24.00B)

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 0 1 25
index-out-of-bounds 0 2 0
invalid-assignment 0 1 1
not-iterable 0 0 2
Total 0 4 28
Raw diff (32 changes)
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/contrib/pytest/test_pytest.py:66:19 error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[str]` with length 1
- tests/contrib/pytest/test_pytest.py:75:46 error[invalid-argument-type] Argument to bound method `Span.get_tag` is incorrect: Expected `str`, found `Unknown | str | None`
+ tests/contrib/pytest/test_pytest.py:75:46 error[invalid-argument-type] Argument to bound method `Span.get_tag` is incorrect: Expected `str`, found `str | None`

jax (https://github.com/google/jax)
- jax/_src/internal_test_util/test_harnesses.py:1841:31 error[index-out-of-bounds] Index -1 is out of bounds for tuple `tuple[()]` with length 0

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- examples/contrib/jsondump.py:137:17 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]`, found `dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((s: Buffer, altchars: Buffer | None = None) -> bytes)]`
+ examples/contrib/jsondump.py:137:17 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]`, found `dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((s: Buffer, altchars: Buffer | None = None) -> bytes)]`
- examples/contrib/jsondump.py:182:20 error[not-iterable] Object of type `None | list[dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]]` may not be iterable
+ examples/contrib/jsondump.py:182:20 error[not-iterable] Object of type `None | list[dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]]` may not be iterable
- examples/contrib/jsondump.py:183:26 error[not-iterable] Object of type `tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | ... omitted 5 union elements` may not be iterable
+ examples/contrib/jsondump.py:183:26 error[not-iterable] Object of type `tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'> | ... omitted 3 union elements` may not be iterable

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/Hash/test_SHA1.py:72:26 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `tuple[str, str] | tuple[str, str, str]`, found `tuple[bytes, Unknown | Literal[b""], Unknown]`
+ lib/Crypto/SelfTest/Hash/test_SHA1.py:72:26 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `tuple[str, ...]`, found `tuple[bytes, Unknown | Literal[b""], Unknown]`

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`

scipy (https://github.com/scipy/scipy)
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/tests/test_build_ext.py:378:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["macros"]` and value of type `list[tuple[str, str] | tuple[str]]` on object of type `dict[str, list[str] | str | list[tuple[str, str, str] | str]]`
+ setuptools/_distutils/tests/test_build_ext.py:378:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["macros"]` and value of type `list[tuple[str, ...]]` on object of type `dict[str, list[str] | str | list[tuple[str, str, str] | str]]`

vision (https://github.com/pytorch/vision)
- test/test_datasets.py:698:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["trainval"]` and value of type `tuple[int, ...]` on object of type `dict[str, tuple[int, int, int] | tuple[int, int] | tuple[int]]`
- test/test_transforms_v2.py:1001:17 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1001:17 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1007:55 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1007:55 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1092:36 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1092:36 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1094:20 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1094:20 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `list[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `list[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`

Full report with detailed diff (timing results)

@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 2 times, most recently from d5e6069 to d427c69 Compare April 18, 2026 16:01
@lerebear lerebear changed the title Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. [ty] Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 21, 2026
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch from d427c69 to 6ffa440 Compare April 21, 2026 14:11
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch from 6ffa440 to 24eb4cb Compare April 21, 2026 14:19
@lerebear lerebear changed the title [ty] Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. [ty] Promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promote tuple size in invariant positions

1 participant