Skip to content

[ty] Narrow equality subscripts on either operand#23104

Merged
charliermarsh merged 2 commits intomainfrom
codex/find-improved-narrowing-case-examples
Feb 10, 2026
Merged

[ty] Narrow equality subscripts on either operand#23104
charliermarsh merged 2 commits intomainfrom
codex/find-improved-narrowing-case-examples

Conversation

@charliermarsh
Copy link
Member

No description provided.

@charliermarsh charliermarsh added the ty Multi-file analysis & type inference label Feb 5, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 5, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 5, 2026

mypy_primer results

Changes were detected when running on open source projects
setuptools (https://github.com/pypa/setuptools)
+ setuptools/_distutils/command/install.py:719:42: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `map[str]`
- Found 1126 diagnostics
+ Found 1127 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler] | Coroutine[Any, Any, T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]]`
+ src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `Unknown | Coroutine[Any, Any, Unknown]`

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/mz_workload_anonymize.py:251:13: error[no-matching-overload] No overload of bound method `join` matches arguments
- Found 534 diagnostics
+ Found 535 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T1'return@call_highest_priority | T2'return@call_highest_priority` has no attribute `pow`
+ sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority` has no attribute `pow`
- sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T1'return@call_highest_priority | T2'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T1'return@call_highest_priority | T2'return@call_highest_priority`, found `MatrixBase`
+ sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T2'return@call_highest_priority | T1'return@call_highest_priority`, found `MatrixBase`
- sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T1'return@call_highest_priority | T2'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T2'return@call_highest_priority | T1'return@call_highest_priority`

@charliermarsh charliermarsh force-pushed the codex/find-improved-narrowing-case-examples branch from a50cbd2 to a5e1af2 Compare February 9, 2026 15:52
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 9, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
unsupported-operator 0 79 0
invalid-return-type 0 4 0
possibly-missing-attribute 0 4 0
invalid-argument-type 0 3 0
unresolved-attribute 0 1 0
Total 0 91 0

Full report with detailed diff (timing results)

@charliermarsh charliermarsh marked this pull request as ready for review February 9, 2026 20:29
@charliermarsh
Copy link
Member Author

I think this is right but it has no ecosystem impact, surprisingly.

@AlexWaygood
Copy link
Member

I think this is right but it has no ecosystem impact, surprisingly.

eh, "yoda comparisons" are discouraged generally, it doesn't surprise me that much!

@AlexWaygood AlexWaygood self-assigned this Feb 10, 2026
@sharkdp sharkdp removed their request for review February 10, 2026 09:49
@charliermarsh charliermarsh force-pushed the codex/find-improved-narrowing-case-examples branch from a5e1af2 to 20210c2 Compare February 10, 2026 13:19
@charliermarsh charliermarsh enabled auto-merge (squash) February 10, 2026 13:21
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 10, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 707.59MB 707.61MB +0.0% (0.02MB)
sphinx 281.67MB 281.68MB +0.0% (0.01MB)
trio 123.55MB 123.55MB +0.0% (0.00MB)
flake8 51.79MB 51.79MB - ☑️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
IntersectionType 2.59MB 2.59MB +0.0% (0.00MB)
is_redundant_with_impl::interned_arguments 6.28MB 6.28MB +0.0% (0.00MB)
all_narrowing_constraints_for_expression 3.63MB 3.64MB +0.3% (0.01MB)
semantic_index 191.51MB 191.51MB +0.0% (0.00MB)
infer_expression_types_impl 53.34MB 53.34MB +0.0% (0.00MB)
place_table 0.72MB 0.72MB +0.0% (0.00MB)
is_redundant_with_impl 6.15MB 6.15MB +0.0% (0.00MB)
all_negative_narrowing_constraints_for_expression 1.58MB 1.59MB +0.0% (0.00MB)
infer_definition_types 86.67MB 86.67MB +0.0% (0.00MB)
infer_scope_types_impl 59.91MB 59.91MB +0.0% (0.00MB)

sphinx

Name Old New Diff Outcome
all_narrowing_constraints_for_expression 1.11MB 1.12MB +0.4% (0.00MB)
all_negative_narrowing_constraints_for_expression 0.66MB 0.67MB +0.3% (0.00MB)
semantic_index 71.78MB 71.78MB +0.0% (0.00MB)
infer_expression_types_impl 22.28MB 22.28MB +0.0% (0.00MB)
infer_definition_types 24.48MB 24.48MB +0.0% (0.00MB)
infer_scope_types_impl 18.31MB 18.31MB +0.0% (0.00MB)

trio

Name Old New Diff Outcome
all_narrowing_constraints_for_expression 0.26MB 0.26MB +0.5% (0.00MB)
semantic_index 34.61MB 34.61MB +0.0% (0.00MB)
infer_expression_types_impl 5.87MB 5.87MB +0.0% (0.00MB)
infer_scope_types_impl 5.83MB 5.83MB +0.0% (0.00MB)

@charliermarsh charliermarsh merged commit ff09ba1 into main Feb 10, 2026
49 checks passed
@charliermarsh charliermarsh deleted the codex/find-improved-narrowing-case-examples branch February 10, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants