Skip to content

[ty] Remove source_order fields from constraint sets; go back to fully reduced BDDs#22578

Draft
dcreager wants to merge 7 commits intodcreager/add-supportfrom
dcreager/support
Draft

[ty] Remove source_order fields from constraint sets; go back to fully reduced BDDs#22578
dcreager wants to merge 7 commits intodcreager/add-supportfrom
dcreager/support

Conversation

@dcreager
Copy link
Member

@dcreager dcreager commented Jan 14, 2026

AS of #23538, we no longer use salsa to intern the nodes of a constraint set BDD. They are still interned, but manually within a specific ConstraintSetBuilder. Those builders are constructed per type comparison. That means that we no longer need to store a separate source_order in our BDD nodes. That was used in an attempt to have something more robust than salsa IDs, which would order constraints based on their relative ordering in the underlying Python source. That ordering is exactly what ConstraintSetBuilder now gives us.

This also lets us revert our short-lived experiment with quasi-reduced BDDs. We introduced quasi-reduction #21744 in an attempt to remove some non-determinism in our tests. This non-determinism came about because a constraint set BDD might contain different sets of individual constraints depending on the (arbitrary) BDD variable ordering that is in force for a particular run of ty. Quasi-reduction ensured that all of the constraints explicitly mentioned when constructing a constraint set actually appeared in the BDD structure, giving us a deterministic set of constraints to iterate over.

@dcreager dcreager added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Jan 14, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 14, 2026

Typing conformance results

No changes detected ✅


The percentage of diagnostics emitted that were expected errors held steady at 86.56%. The percentage of expected errors that received a diagnostic held steady at 77.40%.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 14, 2026

mypy_primer results

Changes were detected when running on open source projects
attrs (https://github.com/python-attrs/attrs)
- tests/test_validators.py:421:24: error[invalid-argument-type] Argument is incorrect: Expected `Any & str`, found `None`
+ tests/test_validators.py:421:24: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `None`
+ tests/test_validators.py:635:21: error[invalid-argument-type] Argument to function `and_` is incorrect: Expected `(Any, Attribute[list[Unknown] | _T'return@min_len], list[Unknown] | _T'return@min_len, /) -> Any`, found `(Any, Attribute[list[Unknown]], list[Unknown], /) -> Any`
+ tests/test_validators.py:786:21: error[invalid-argument-type] Argument to function `and_` is incorrect: Expected `(Any, Attribute[str | _T'return@min_len], str | _T'return@min_len, /) -> Any`, found `(Any, Attribute[str], str, /) -> Any`
+ tests/test_validators.py:788:21: error[invalid-argument-type] Argument to function `and_` is incorrect: Expected `(Any, Attribute[dict[Unknown, Unknown] | _T'return@max_len], dict[Unknown, Unknown] | _T'return@max_len, /) -> Any`, found `(Any, Attribute[dict[Unknown, Unknown]], dict[Unknown, Unknown], /) -> Any`
- Found 640 diagnostics
+ Found 643 diagnostics

more-itertools (https://github.com/more-itertools/more-itertools)
- more_itertools/recipes.py:1099:18: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(int | float | complex | ... omitted 3 union elements, int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], /) -> int | float | complex | ... omitted 3 union elements`, found `Overload[(base: int, exp: int, mod: int) -> int, (base: int, exp: Literal[0], mod: None = None) -> Literal[1], (base: int, exp: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], mod: None = None) -> int, (base: int, exp: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], mod: None = None) -> int | float, (base: int, exp: int, mod: None = None) -> Any, (base: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], exp: int | float, mod: None = None) -> int | float, (base: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], exp: int | float, mod: None = None) -> int | float | complex, (base: int | float, exp: int, mod: None = None) -> int | float, (base: int | float, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> Any, (base: int | float | complex, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> int | float | complex, [_E_contra, _T_co](base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _T_co](base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _M_contra, _T_co](base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float, mod: None = None) -> Any, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float | complex, mod: None = None) -> int | float | complex]`
+ more_itertools/recipes.py:1099:18: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(int | float | complex | ... omitted 5 union elements, int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], /) -> int | float | complex | ... omitted 7 union elements`, found `Overload[(base: int, exp: int, mod: int) -> int, (base: int, exp: Literal[0], mod: None = None) -> Literal[1], (base: int, exp: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], mod: None = None) -> int, (base: int, exp: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], mod: None = None) -> int | float, (base: int, exp: int, mod: None = None) -> Any, (base: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], exp: int | float, mod: None = None) -> int | float, (base: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], exp: int | float, mod: None = None) -> int | float | complex, (base: int | float, exp: int, mod: None = None) -> int | float, (base: int | float, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> Any, (base: int | float | complex, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> int | float | complex, [_E_contra, _T_co](base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _T_co](base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _M_contra, _T_co](base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float, mod: None = None) -> Any, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float | complex, mod: None = None) -> int | float | complex]`

pip (https://github.com/pypa/pip)
+ src/pip/_internal/operations/check.py:133:42: error[invalid-assignment] Object of type `frozenset[Unknown | _S@union]` is not assignable to `frozenset[Tag]`
- Found 631 diagnostics
+ Found 632 diagnostics

jinja (https://github.com/pallets/jinja)
- src/jinja2/environment.py:1661:30: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/jinja2/filters.py:523:12: error[invalid-return-type] Return type does not match returned value: expected `V@do_min | Undefined`, found `V@do_min | SupportsRichComparisonT@min | Undefined`
+ src/jinja2/filters.py:543:12: error[invalid-return-type] Return type does not match returned value: expected `V@do_max | Undefined`, found `V@do_max | SupportsRichComparisonT@max | _T1@max | Undefined`
- Found 181 diagnostics
+ Found 182 diagnostics

spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/jinja2/environment.py:1656:30: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 4401 diagnostics
+ Found 4400 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | ((dict[str, int | float | str | ... omitted 3 union elements], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
+ pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | ((dict[str, Divergent], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
- pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
+ pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
- pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`
+ pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, Divergent], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`

Expression (https://github.com/cognitedata/Expression)
+ expression/collections/seq.py:637:27: error[invalid-assignment] Object of type `Iterable[int | _A@identity]` is not assignable to `Iterable[int]`
+ expression/extra/parser.py:32:16: error[invalid-return-type] Return type does not match returned value: expected `Result[_A@Parser, str]`, found `Unknown | Result[_A@Parser | _TSource@fst, str]`
- tests/test_compose.py:21:16: error[invalid-assignment] Object of type `(Never, /) -> Never` is not assignable to `(int, /) -> int`
+ tests/test_compose.py:21:16: error[invalid-assignment] Object of type `(_A@identity, /) -> _A@identity` is not assignable to `(int, /) -> int`
- Found 202 diagnostics
+ Found 204 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/context.py:1141:30: error[no-matching-overload] No overload of bound method `send_message` matches arguments
- Found 536 diagnostics
+ Found 537 diagnostics

setuptools (https://github.com/pypa/setuptools)
+ setuptools/_distutils/filelist.py:70:31: error[no-matching-overload] No overload of function `join` matches arguments
- setuptools/_vendor/more_itertools/recipes.py:1174:18: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(int | float | complex | ... omitted 3 union elements, int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], /) -> int | float | complex | ... omitted 3 union elements`, found `Overload[(base: int, exp: int, mod: int) -> int, (base: int, exp: Literal[0], mod: None = None) -> Literal[1], (base: int, exp: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], mod: None = None) -> int, (base: int, exp: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], mod: None = None) -> int | float, (base: int, exp: int, mod: None = None) -> Any, (base: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], exp: int | float, mod: None = None) -> int | float, (base: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], exp: int | float, mod: None = None) -> int | float | complex, (base: int | float, exp: int, mod: None = None) -> int | float, (base: int | float, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> Any, (base: int | float | complex, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> int | float | complex, [_E_contra, _T_co](base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _T_co](base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _M_contra, _T_co](base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float, mod: None = None) -> Any, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float | complex, mod: None = None) -> int | float | complex]`
+ setuptools/_vendor/more_itertools/recipes.py:1174:18: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(int | float | complex | ... omitted 5 union elements, int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], /) -> int | float | complex | ... omitted 6 union elements`, found `Overload[(base: int, exp: int, mod: int) -> int, (base: int, exp: Literal[0], mod: None = None) -> Literal[1], (base: int, exp: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], mod: None = None) -> int, (base: int, exp: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], mod: None = None) -> int | float, (base: int, exp: int, mod: None = None) -> Any, (base: Literal[1, 2, 3, 4, 5, ... omitted 20 literals], exp: int | float, mod: None = None) -> int | float, (base: Literal[-1, -2, -3, -4, -5, ... omitted 15 literals], exp: int | float, mod: None = None) -> int | float | complex, (base: int | float, exp: int, mod: None = None) -> int | float, (base: int | float, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> Any, (base: int | float | complex, exp: int | float | complex | _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], mod: None = None) -> int | float | complex, [_E_contra, _T_co](base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _T_co](base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co, [_E_contra, _M_contra, _T_co](base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float, mod: None = None) -> Any, (base: _SupportsPow2[Any, Any] | _SupportsPow3[Any, Any, Any], exp: int | float | complex, mod: None = None) -> int | float | complex]`
- Found 1117 diagnostics
+ Found 1118 diagnostics

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/catalog/utils/__init__.py:132:17: error[no-matching-overload] No overload of bound method `search` matches arguments
- openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `Unknown | str`
+ openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `Pattern[AnyStr@compile] | Unknown | str`
- Found 1152 diagnostics
+ Found 1153 diagnostics

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/reshape/merge.py:2682:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `_ScalarT@take`
+ pandas/core/reshape/merge.py:2685:41: error[invalid-argument-type] Argument to function `_get_join_keys` is incorrect: Expected `list[ndarray[tuple[Any, ...], dtype[signedinteger[_64Bit]]]]`, found `list[_ScalarT@take | Any | ndarray[tuple[Any, ...], dtype[_ScalarT@take]] | ndarray[tuple[Any, ...], dtype[Any]]] | list[Unknown]`
- pandas/tests/arithmetic/test_datetime64.py:2232:36: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | bytes | None | ... omitted 7 union elements, str | Literal[b"Y", b"M", b"W", b"D", b"h", ... omitted 8 literals] | tuple[Literal["Y", "M", "W", "D", "h", ... omitted 22 literals], SupportsIndex] | Unknown, /) -> timedelta64[None] | timedelta64[int] | timedelta64[timedelta]`, found `<class 'timedelta64'>`
+ pandas/tests/arithmetic/test_datetime64.py:2232:36: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | bytes | None | ... omitted 7 union elements, str | Literal[b"Y", b"M", b"W", b"D", b"h", ... omitted 8 literals] | tuple[Literal["Y", "M", "W", "D", "h", ... omitted 22 literals], SupportsIndex] | Unknown, /) -> timedelta64[None] | timedelta64[int] | timedelta64[timedelta] | timedelta64[_TD64ItemT_co@timedelta64]`, found `<class 'timedelta64'>`
- Found 4460 diagnostics
+ Found 4462 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/geometry/point.py:1296:25: error[unresolved-attribute] Attribute `tolist` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/geometry/point.py:1296:25: error[unresolved-attribute] Attribute `tolist` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/integrals/tests/test_heurisch.py:390:17: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/integrals/tests/test_heurisch.py:390:17: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/decompositions.py:1334:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/decompositions.py:1334:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/decompositions.py:1348:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/decompositions.py:1348:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/eigen.py:328:22: error[invalid-argument-type] Argument to bound method `_as_type` is incorrect: Expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown`
+ sympy/matrices/eigen.py:328:22: error[invalid-argument-type] Argument to bound method `_as_type` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Unknown`
- sympy/matrices/expressions/tests/test_derivatives.py:552:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_derivatives.py:552:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matadd.py:37:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_matadd.py:37:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matmul.py:159:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_matmul.py:159:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:124:46: error[unsupported-operator] Operator `**` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Literal[2]`
+ sympy/matrices/expressions/tests/test_matpow.py:124:46: error[unsupported-operator] Operator `**` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Literal[2]`
- sympy/matrices/expressions/tests/test_permutation.py:28:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_permutation.py:28:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/inverse.py:384:11: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/inverse.py:384:11: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/inverse.py:392:11: error[unsupported-operator] Unary operator `-` is not supported for object of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/inverse.py:392:11: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/inverse.py:393:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase | Expr`
+ sympy/matrices/inverse.py:393:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase | Expr`
- sympy/matrices/inverse.py:393:22: error[unsupported-operator] Unary operator `-` is not supported for object of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/inverse.py:393:22: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr, T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr, /) -> T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
+ sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, /) -> T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
- 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: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 | Tmat@__add__`
- 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:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T1'return@call_highest_priority | T2'return@call_highest_priority | Tmat@__add__`, found `MatrixBase`
- sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/matrixbase.py:5073:28: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
+ sympy/matrices/matrixbase.py:5073:28: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
- sympy/matrices/matrixbase.py:5076:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
+ sympy/matrices/matrixbase.py:5076:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
- sympy/matrices/solvers.py:637:27: error[invalid-argument-type] Argument to bound method `vstack` is incorrect: Argument type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown` does not satisfy upper bound `MatrixBase` of type variable `Self`
+ sympy/matrices/solvers.py:637:27: error[invalid-argument-type] Argument to bound method `vstack` is incorrect: Argument type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Unknown` does not satisfy upper bound `MatrixBase` of type variable `Self`
- sympy/matrices/solvers.py:637:27: error[invalid-argument-type] Argument to bound method `vstack` is incorrect: Expected `Tmat@_gauss_jordan_solve`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown`
+ sympy/matrices/solvers.py:637:27: error[invalid-argument-type] Argument to bound method `vstack` is incorrect: Expected `Tmat@_gauss_jordan_solve`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Unknown`
- sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/sparse.py:418:16: error[unresolved-attribute] Attribute `inv` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/sparse.py:418:16: error[unresolved-attribute] Attribute `inv` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:24:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:24:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:33:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:33:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:43:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:43:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:52:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:52:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:58:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:58:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:78:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:78:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:85:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:85:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:91:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:91:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:104:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:104:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:111:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:111:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:124:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:124:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:132:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:132:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:289:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:289:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:291:13: error[unsupported-operator] Operator `-` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:291:13: error[unsupported-operator] Operator `-` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:346:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:346:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:349:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:349:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:356:23: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:356:23: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:394:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:394:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:395:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:395:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:396:16: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:396:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:397:16: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:397:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:440:22: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:440:22: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:452:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:452:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:465:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:465:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:476:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:476:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:489:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:489:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:258:16: error[unresolved-attribute] Attribute `n` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_eigen.py:258:16: error[unresolved-attribute] Attribute `n` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_eigen.py:307:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:307:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:308:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:308:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:323:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:323:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:324:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:324:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:365:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:365:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:366:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:366:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:381:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:381:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:382:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:382:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:406:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:406:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:478:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:478:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:493:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:493:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:794:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:794:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:222:40: error[invalid-argument-type] Argument to bound method `multiply_elementwise` is incorrect: Expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:222:40: error[invalid-argument-type] Argument to bound method `multiply_elementwise` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:395:16: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:395:16: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1582:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1582:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1588:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1588:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1595:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1595:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1600:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1600:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1608:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1608:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1617:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1617:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1740:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1740:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2558:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2558:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2681:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2681:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2682:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2682:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2683:16: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2683:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2684:16: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2684:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2729:16: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2729:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2747:25: error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `Unknown | T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2747:25: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:3056:33: error[unresolved-attribute] Attribute `analytic_func` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:3056:33: error[unresolved-attribute] Attribute `analytic_func` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:3072:60: error[unresolved-attribute] Attribute `exp` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:3072:60: error[unresolved-attribute] Attribute `exp` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase

... (truncated 161 lines) ...

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 30 skipped benchmarks1


Comparing dcreager/support (d9c9e16) with dcreager/add-support (df5302e)2

Open in CodSpeed

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on dcreager/add-support (2b07c2c) during the generation of this report, so c63f80c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@dcreager dcreager force-pushed the dcreager/support branch 2 times, most recently from dcf8097 to 33bd081 Compare January 14, 2026 19:10
@dcreager dcreager force-pushed the dcreager/lazy-sequent-map branch from 5b240fb to 6555491 Compare January 17, 2026 17:53
Base automatically changed from dcreager/lazy-sequent-map to main January 20, 2026 21:15
@dcreager dcreager force-pushed the dcreager/support branch 2 times, most recently from 70751f8 to 73e182d Compare January 27, 2026 15:40
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 2, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 697.21MB 697.25MB +0.00% (34.80kB)
sphinx 266.86MB 266.87MB +0.01% (14.74kB)
trio 118.47MB 118.48MB +0.00% (1.25kB)
flake8 48.07MB 48.07MB +0.00% (640.00B)

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
infer_expression_types_impl 60.38MB 60.39MB +0.02% (9.82kB)
infer_definition_types 88.28MB 88.29MB +0.01% (7.66kB)
infer_expression_type_impl 14.28MB 14.29MB +0.04% (5.27kB)
UnionType<'db>::from_two_elements_::interned_arguments 2.45MB 2.44MB -0.12% (3.01kB)
UnionType 3.61MB 3.62MB +0.08% (2.95kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 9.71MB 9.71MB +0.03% (2.53kB)
all_narrowing_constraints_for_expression 6.92MB 6.93MB +0.03% (2.44kB)
GenericAlias<'db>::variance_of_ 571.88kB 574.12kB +0.39% (2.25kB)
all_negative_narrowing_constraints_for_expression 2.59MB 2.59MB +0.08% (2.11kB)
infer_deferred_types 14.31MB 14.31MB +0.01% (1.41kB)
FunctionType<'db>::signature_ 3.87MB 3.87MB +0.03% (1.12kB)
Type<'db>::member_lookup_with_policy_ 15.27MB 15.27MB -0.01% (1.08kB)
Type<'db>::class_member_with_policy_ 17.13MB 17.13MB -0.00% (864.00B)
UnionType<'db>::from_two_elements_ 5.56MB 5.56MB -0.01% (580.00B)
IntersectionType<'db>::from_two_elements_ 356.05kB 356.59kB +0.15% (556.00B)
... 8 more

sphinx

Name Old New Diff Outcome
check_file_impl 5.04MB 5.03MB -0.21% (10.83kB)
infer_definition_types 24.30MB 24.31MB +0.03% (6.94kB)
StaticClassLiteral<'db>::try_mro_ 2.17MB 2.18MB +0.14% (3.03kB)
Specialization 1.05MB 1.05MB +0.11% (1.20kB)
UnionType 1.30MB 1.30MB +0.09% (1.20kB)
infer_expression_types_impl 21.84MB 21.84MB +0.01% (1.20kB)
Type<'db>::class_member_with_policy_ 7.59MB 7.59MB +0.01% (1.15kB)
Type<'db>::apply_specialization_ 1.74MB 1.75MB +0.06% (1.14kB)
FunctionType 3.15MB 3.15MB +0.03% (1.08kB)
Type<'db>::apply_specialization_::interned_arguments 1.48MB 1.48MB +0.07% (1.02kB)
Type<'db>::try_call_dunder_get_ 4.97MB 4.97MB +0.02% (1.02kB)
IntersectionType<'db>::from_two_elements_ 217.13kB 218.01kB +0.40% (900.00B)
UnionType<'db>::from_two_elements_::interned_arguments 760.55kB 759.69kB -0.11% (880.00B)
IntersectionType<'db>::from_two_elements_::interned_arguments 181.59kB 182.36kB +0.43% (792.00B)
Type<'db>::class_member_with_policy_::interned_arguments 4.01MB 4.01MB +0.02% (728.00B)
... 25 more

trio

Name Old New Diff Outcome
UnionType 334.80kB 335.67kB +0.26% (896.00B)
UnionType<'db>::from_two_elements_::interned_arguments 166.89kB 166.63kB -0.15% (264.00B)
IntersectionType 250.42kB 250.59kB +0.07% (168.00B)
infer_definition_types 7.63MB 7.63MB +0.00% (144.00B)
infer_deferred_types 2.37MB 2.37MB +0.00% (96.00B)
IntersectionType<'db>::from_two_elements_ 70.52kB 70.61kB +0.13% (92.00B)
IntersectionType<'db>::from_two_elements_::interned_arguments 63.34kB 63.42kB +0.14% (88.00B)
infer_scope_types_impl 4.80MB 4.80MB +0.00% (24.00B)
infer_expression_types_impl 7.15MB 7.15MB +0.00% (24.00B)
UnionType<'db>::from_two_elements_ 298.23kB 298.24kB +0.00% (12.00B)

flake8

Name Old New Diff Outcome
UnionType 111.19kB 111.62kB +0.39% (448.00B)
UnionType<'db>::from_two_elements_ 99.63kB 99.75kB +0.12% (120.00B)
infer_definition_types 1.88MB 1.88MB +0.00% (48.00B)
infer_scope_types_impl 1007.40kB 1007.43kB +0.00% (24.00B)

@dcreager dcreager changed the title [ty] Track constraint set "support" separately; go back to fully reduced BDDs [ty] Remove source_order fields from constraint sets; go back to fully reduced BDDs Mar 2, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 2, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
unsupported-operator 0 0 95
unresolved-attribute 1 0 41
invalid-argument-type 13 1 20
invalid-return-type 6 0 2
invalid-assignment 3 0 1
no-matching-overload 3 0 0
not-iterable 0 0 2
unused-type-ignore-comment 0 2 0
Total 26 3 161

Full report with detailed diff (timing results)

@dcreager dcreager changed the base branch from main to dcreager/add-support March 5, 2026 19:57
dcreager added a commit that referenced this pull request Mar 5, 2026
…ter (#23715)

I discovered this while looking into some unexpected ecosystem results
on #22578. It took a couple of
days of wrestling with pi to discover the issue and reduce it to the
following example:

```py
def f(l: list[tuple[Any | str, Any | str]]) -> None:
    # was:       dict[str | Any, str | Any]
    # should be: dict[Any | str, Any | str]
    reveal_type(dict(l))
```

We are trying to infer a specialization of `dict` when we pass in the
`list[tuple[...]]` type an argument. This matches against the
constructor overload that takes in an `Iterator[tuple[_KT, _VT]]`. All
good so far.

As part of doing that, we create the constraint set `(Any | str ≤ _KT) ∧
(Any | str ≤ _VT)`, which has the following structure:

```
<0> (str ≤ _VT@dict) 4/4
┡━₁ <1> (Any ≤ _VT@dict) 3/3
│   ┡━₁ <2> (str ≤ _KT@dict) 2/2
│   │   ┡━₁ <3> (Any ≤ _KT@dict) 1/1
│   │   │   ┡━₁ always
│   │   │   └─₀ never
│   │   └─₀ never
│   └─₀ never
└─₀ never
```

A few interesting things have happened:

- Both typevars correctly have lower bound (contravariant) constraints:
function parameters are contravariant; `Iterator` is covariant; contra ×
co = contra
- The constraint set lines up with "source order": the type explicitly
mentioned in the code is `Any | str`, and `_KT` appears before `_VT` in
the definition of `dict`.
- We break apart lower bound unions: e.g. `Any | str ≤ _KT` becomes
`(Any ≤ _KT) ∧ (str ≤ _KT)`
- That gives us four "atomic" constraints, which we correctly create in
source order: `Any ≤ _KT`, `str ≤ _KT`, `Any ≤ _VT`, `str ≤ _VT`. (The
`1/1` etc in the graph rendering is the `source_order` that we have
assigned to each constraint.)
- Our BDDs use the _reverse_ of the constraint ID ordering, so the
constraint with the smallest ID (`Any ≤ _KT`) appears closest to the
leaf nodes. (This is on purpose for efficiency reasons)

Everything described so far is correct and expected behavior.

Next we have to find a solution for this constraint set. To do that, we
find every path from the root to the `always` terminal, remembering all
of the constraints that we encounter along that path. In this case,
there is only one path:

```
str ≤ _VT (4)
Any ≤ _VT (3)
str ≤ _KT (2)
Any ≤ _KT (1)
```

Those constraints are still in reverse order! But we're tracking a
`source_order` for each constraint, and we [sort by
`source_order`](https://github.com/astral-sh/ruff/blob/149c5786ca6ae135431b86d1cd8ab74763b9a95a/crates/ty_python_semantic/src/types/constraints.rs#L3042-L3051)
before turning this list of constraints into a solution. That _should_
mean that we build up the unions as `Any | str`.

So why were we seeing `str | Any` instead? If you print out the
`source_order`s that we actually see when we get to the sort, we have:

```
str ≤ _VT (4)
Any ≤ _VT (4)
str ≤ _KT (2)
Any ≤ _KT (2)
```

The `Any` constraints have copied their `source_order`s from the
corresponding `str` constraints!

What has happened is that some purposeful behavior has engaged too
aggressively. When we look at a path that represents a solution, we want
to know _all_ of the constraints that are true for that path — not just
the ones that are explicitly mentioned in the BDD. We have a
`SequentMap` type that records the relationships between constraints.
Among other things, it records _implications_: "when X is true, Y is
true as well". As we build up potential paths, each time we add one of
the constraints from the BDD, we immediately check the sequent map to
see if we now know any other _derived_ facts to be true. If so, we add
them to the path. And importantly, we want those derived facts to appear
"near" their "origin" constraint — so we give the derived constraint the
same `source_order` as the BDD constraint we just added.

In this case, the first constraint we encounter in the BDD is `str ≤ _VT
(4)`. The sequent map tells us that `str ≤ _VT` implies `Any ≤ _VT`, so
we add `Any ≤ _VT` as a _derived_ constraint, which inherits
`source_order=4` from its origin constraint. Next we encounter `Any ≤
_VT` as an _origin_ constraint (since it appears in the BDD). But since
it's already in the path, we don't add it as a duplicate or update its
`source_order`.

The fix is straightforward: origin `source_order`s should take
precedence over inherited derived `source_order`s.
@dcreager dcreager force-pushed the dcreager/add-support branch from df5302e to 2b07c2c Compare March 5, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant