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 258.60MB 258.69MB +0.03% (84.92kB)
prefect 703.84MB 703.87MB +0.00% (30.70kB)
flake8 47.68MB 47.69MB +0.02% (8.25kB)
trio 116.46MB 116.46MB +0.00% (540.00B)

Significant changes

Click to expand detailed breakdown

sphinx

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 1.91MB 1.93MB +1.54% (30.10kB)
infer_expression_types_impl 20.61MB 20.62MB +0.05% (9.62kB)
Specialization 1003.84kB 1013.36kB +0.95% (9.52kB)
GenericAlias 418.01kB 424.12kB +1.46% (6.12kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 444.80kB 450.77kB +1.34% (5.98kB)
TupleType<'db>::to_class_type_ 147.91kB 153.83kB +4.00% (5.92kB)
is_redundant_with_impl 930.76kB 936.31kB +0.60% (5.55kB)
is_redundant_with_impl::interned_arguments 1.08MB 1.08MB +0.50% (5.50kB)
UnionType 463.84kB 465.36kB +0.33% (1.52kB)
IntersectionType 463.96kB 465.44kB +0.32% (1.48kB)
infer_deferred_types 5.52MB 5.52MB +0.02% (1.36kB)
function_known_decorators 2.45MB 2.45MB +0.05% (1.36kB)
infer_definition_types 23.56MB 23.56MB +0.00% (816.00B)
infer_scope_types_impl 15.36MB 15.36MB +0.00% (108.00B)

prefect

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 4.25MB 4.26MB +0.23% (10.03kB)
function_known_decorators 8.26MB 8.26MB +0.07% (5.89kB)
infer_deferred_types 14.60MB 14.61MB +0.04% (5.85kB)
Specialization 2.12MB 2.12MB +0.13% (2.83kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 1.05MB 1.05MB +0.18% (1.97kB)
GenericAlias 907.24kB 909.00kB +0.19% (1.76kB)
TupleType<'db>::to_class_type_ 462.38kB 463.20kB +0.18% (844.00B)
infer_definition_types 90.08MB 90.08MB +0.00% (768.00B)
infer_expression_types_impl 62.83MB 62.83MB +0.00% (468.00B)
infer_scope_types_impl 54.75MB 54.75MB +0.00% (240.00B)
UnionType 938.97kB 939.08kB +0.01% (112.00B)

flake8

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 305.97kB 309.47kB +1.14% (3.50kB)
Specialization 156.56kB 157.66kB +0.70% (1.09kB)
infer_deferred_types 691.35kB 692.15kB +0.12% (816.00B)
function_known_decorators 317.94kB 318.73kB +0.25% (816.00B)
GenericAlias 67.92kB 68.62kB +1.04% (720.00B)
StaticClassLiteral<'db>::try_mro_::interned_arguments 69.82kB 70.52kB +1.01% (720.00B)
TupleType<'db>::to_class_type_ 13.21kB 13.62kB +3.13% (424.00B)
infer_definition_types 1.86MB 1.86MB +0.01% (156.00B)
infer_expression_types_impl 1.03MB 1.03MB +0.01% (96.00B)

trio

Name Old New Diff Outcome
infer_expression_types_impl 6.98MB 6.98MB +0.00% (324.00B)
infer_definition_types 7.55MB 7.55MB +0.00% (120.00B)
infer_scope_types_impl 4.71MB 4.71MB +0.00% (48.00B)
infer_deferred_types 2.34MB 2.34MB +0.00% (24.00B)
function_known_decorators 920.43kB 920.45kB +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 2 times, most recently 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
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch from 24eb4cb to 4a4fc97 Compare April 22, 2026 03:12
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch from 4a4fc97 to e07bed2 Compare April 22, 2026 03:18
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