Skip to content

[ty] Ban ... in odd places inside tuple specializations #22889

Merged
AlexWaygood merged 1 commit intomainfrom
alex/tuple-ellipses
Jan 27, 2026
Merged

[ty] Ban ... in odd places inside tuple specializations #22889
AlexWaygood merged 1 commit intomainfrom
alex/tuple-ellipses

Conversation

@AlexWaygood
Copy link
Member

Summary

(Stacked on top of #22884.)

This is mandated by the typing conformance suite

Test Plan

mdtests

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Jan 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 78.95% to 79.08%. The percentage of expected errors that received a diagnostic increased from 69.88% to 70.44%.

Summary

Metric Old New Diff Outcome
True Positives 754 760 +6 ⏫ (✅)
False Positives 201 201 +0
False Negatives 325 319 -6 ⏬ (✅)
Total Diagnostics 955 961 +6
Precision 78.95% 79.08% +0.13% ⏫ (✅)
Recall 69.88% 70.44% +0.56% ⏫ (✅)

True positives added

Details
Location Name Message
tuples_type_form.py:40:6 invalid-type-form Invalid tuple specialization: ... can only be used as the second element in a two-element tuple specialization
tuples_type_form.py:41:6 invalid-type-form Invalid tuple specialization: ... can only be used as the second element in a two-element tuple specialization
tuples_type_form.py:42:6 invalid-type-form Invalid tuple specialization: ... can only be used as the second element in a two-element tuple specialization
tuples_type_form.py:43:6 invalid-type-form Invalid tuple specialization: ... can only be used as the second element in a two-element tuple specialization
tuples_type_form.py:44:6 invalid-type-form Invalid tuple specialization: ... cannot be used after an unpacked element
tuples_type_form.py:45:6 invalid-type-form Invalid tuple specialization: ... cannot be used after an unpacked element

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

mypy_primer results

Changes were detected when running on open source projects
prefect (https://github.com/PrefectHQ/prefect)
+ src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type `dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
+ src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type `int | dict[Any, Any] | float | ... omitted 3 union elements` is not assignable to `dict[str, Any]`
+ src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type `dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
+ src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type `int | dict[Any, Any] | float | ... omitted 3 union elements` is not assignable to `dict[str, Any]`
+ src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Argument type `dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elements` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown | dict[str, Any]` on object of type `dict[str, Any]`
+ src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `dict[str, Any] | int | Unknown | ... omitted 4 union elements` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | dict[str, Any]]`
+ src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | dict[str, Any] | int | ... omitted 4 union elements]`
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown]`
+ src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown | int | float | ... omitted 4 union elements]`
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown]`
+ src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown | int | float | ... omitted 4 union elements]`
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type `str | dict[str, Any]` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
+ src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type `dict[str, Any] | int | str | ... omitted 3 union elements` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
+ src/prefect/workers/base.py:234:20: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found `int | Unknown | float | ... omitted 4 union elements`
- Found 5362 diagnostics
+ Found 5368 diagnostics

static-frame (https://github.com/static-frame/static-frame)
+ static_frame/test/unit/test_type_clinic.py:258:37: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
+ static_frame/test/unit/test_type_clinic.py:673:32: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
+ static_frame/test/unit/test_type_clinic.py:673:32: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
+ static_frame/test/unit/test_type_clinic.py:744:55: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
+ static_frame/test/unit/test_type_clinic.py:744:55: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
+ static_frame/test/unit/test_type_clinic.py:802:77: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization
- Found 1819 diagnostics
+ Found 1825 diagnostics

No memory usage changes detected ✅

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Jan 27, 2026

@AlexWaygood AlexWaygood marked this pull request as ready for review January 27, 2026 15:59
Base automatically changed from alex/two-starred-tuples to main January 27, 2026 16:44
@AlexWaygood AlexWaygood enabled auto-merge (squash) January 27, 2026 16:45
@AlexWaygood AlexWaygood merged commit 1986973 into main Jan 27, 2026
44 checks passed
@AlexWaygood AlexWaygood deleted the alex/tuple-ellipses branch January 27, 2026 16:49
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.

2 participants