Skip to content

[ty] Support partially specialized type context#22748

Merged
ibraheemdev merged 3 commits intomainfrom
ibraheem/partial-tcx
Feb 6, 2026
Merged

[ty] Support partially specialized type context#22748
ibraheemdev merged 3 commits intomainfrom
ibraheem/partial-tcx

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Jan 19, 2026

Summary

We currently ignore type context that contains inferable type variables. Instead, we can specialize these to a special marker type which is ignored when inferring from the type context, while still using the rest of the type.

Part of astral-sh/ty#2521.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Jan 19, 2026
@ibraheemdev ibraheemdev force-pushed the ibraheem/partial-tcx branch 2 times, most recently from 369f185 to 1f98abe Compare January 19, 2026 23:16
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 19, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 19, 2026

mypy_primer results

Changes were detected when running on open source projects
asynq (https://github.com/quora/asynq)
- asynq/tests/test_tools.py:129:30: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((int, /) -> Any) | None`, found `list[Unknown | int]`
+ asynq/tests/test_tools.py:129:30: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((Unknown | int, /) -> Any) | None`, found `list[Unknown | int]`

porcupine (https://github.com/Akuli/porcupine)
+ porcupine/pluginmanager.py:133:49: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | str`
- Found 24 diagnostics
+ Found 25 diagnostics

Expression (https://github.com/cognitedata/Expression)
+ expression/collections/maptree.py:113:25: error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance | Unknown, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
+ expression/collections/maptree.py:121:27: error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance | Unknown, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
+ expression/collections/maptree.py:136:29: error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Unknown | Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
+ expression/collections/maptree.py:141:61: error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Unknown | Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
- Found 201 diagnostics
+ Found 205 diagnostics

mypy (https://github.com/python/mypy)
- mypyc/irbuild/util.py:35:44: error[invalid-assignment] Object of type `frozenset[str]` is not assignable to `frozenset[Literal["native_class", "allow_interpreted_subclasses", "serializable", "free_list_len"]]`
+ mypyc/irbuild/util.py:35:44: error[invalid-assignment] Object of type `frozenset[Unknown | str]` is not assignable to `frozenset[Literal["native_class", "allow_interpreted_subclasses", "serializable", "free_list_len"]]`

koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/generic.py:166:53: error[invalid-argument-type] Argument is incorrect: Expected `list[Predicate[Any] | PredicateAsync[Any]]`, found `list[EqualTo[ExactMatchT@EqualsValidator]]`
+ koda_validate/tuple.py:303:49: error[invalid-argument-type] Argument is incorrect: Expected `list[Predicate[Any] | PredicateAsync[Any]]`, found `list[Predicate[tuple[Any, ...]]]`
+ koda_validate/tuple.py:342:49: error[invalid-argument-type] Argument is incorrect: Expected `list[Predicate[Any] | PredicateAsync[Any]]`, found `list[Predicate[tuple[Any, ...]]]`
- Found 400 diagnostics
+ Found 403 diagnostics

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/context/menu.py:57:96: error[invalid-assignment] Object of type `frozenset[CommandType]` is not assignable to `frozenset[Literal[CommandType.USER, CommandType.MESSAGE]]`
+ tanjun/context/menu.py:57:96: error[invalid-assignment] Object of type `frozenset[Unknown | CommandType]` is not assignable to `frozenset[Literal[CommandType.USER, CommandType.MESSAGE]]`

trio (https://github.com/python-trio/trio)
- src/trio/_core/_tests/test_run.py:2871:22: error[invalid-assignment] Object of type `ExceptionGroup[Exception]` is not assignable to `ValueError | ExceptionGroup[ValueError]`
- Found 472 diagnostics
+ Found 471 diagnostics

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/interpreter/compiler.py:161:5: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str | ContainerTypeInfo | type, str | tuple[str, str]] | None`, found `dict[ContainerTypeInfo | type, str | tuple[str, str]]`
+ mesonbuild/interpreter/type_checking.py:278:5: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[list[BuildTarget | CustomTarget | CustomTargetIndex] | ContainerTypeInfo | type, str | tuple[str, str]] | None`, found `dict[ContainerTypeInfo | type, str | tuple[str, str]]`
+ mesonbuild/interpreter/type_checking.py:313:5: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str | list[str] | dict[str, str | int | list[str]] | ContainerTypeInfo | type, str | tuple[str, str]] | None`, found `dict[ContainerTypeInfo | type, str | tuple[str, str]]`
+ mesonbuild/interpreter/type_checking.py:540:5: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str | None | ContainerTypeInfo | type, str | tuple[str, str]] | None`, found `dict[ContainerTypeInfo | type | str, str | tuple[str, str]]`
+ mesonbuild/interpreter/type_checking.py:553:5: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str | File | CustomTarget | ... omitted 4 union elements, str | tuple[str, str]] | None`, found `dict[ContainerTypeInfo | type, str | tuple[str, str]]`
- Found 2188 diagnostics
+ Found 2193 diagnostics

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_backends.py:3795:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, bool | dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`, found `dict[str, bool]`
+ xarray/tests/test_backends.py:3795:47: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, bool | dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`, found `dict[str, dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`
+ xarray/tests/test_backends.py:3812:25: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, bool | dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`, found `dict[str, bool]`
+ xarray/tests/test_backends.py:3812:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, bool | dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`, found `dict[str, dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | int]]]`
- Found 1746 diagnostics
+ Found 1750 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/deployments/runner.py:1017:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/deployments/runner.py:1017:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | ((...) -> Any)`
+ src/prefect/flow_engine.py:997:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
+ src/prefect/flow_engine.py:1596:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
+ src/prefect/flow_engine.py:1677:43: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Unknown | R@run_generator_flow_sync`
+ src/prefect/flow_engine.py:1685:21: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_sync`
+ src/prefect/flow_engine.py:1719:44: warning[possibly-missing-attribute] Attribute `__anext__` may be missing on object of type `Unknown | R@run_generator_flow_async`
+ src/prefect/flow_engine.py:1726:25: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_async`
- src/prefect/flows.py:285:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:285:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- src/prefect/flows.py:403:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:403:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- src/prefect/flows.py:1885:53: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/prefect/flows.py:1945:21: error[no-matching-overload] No overload of function `run_coro_as_sync` matches arguments
- Found 5456 diagnostics
+ Found 5462 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 50 diagnostics
+ Found 49 diagnostics

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/models/callbacks.py:212:21: error[invalid-assignment] Object of type `Required[Unknown]` is not assignable to `HasProps`
+ src/bokeh/models/callbacks.py:212:21: error[invalid-assignment] Object of type `Required[HasProps]` is not assignable to `HasProps`

rotki (https://github.com/rotki/rotki)
- rotkehlchen/tests/unit/test_tokens.py:202:9: error[invalid-argument-type] Argument to function `generate_multicall_chunks` is incorrect: Expected `Mapping[ChecksumAddress, Sequence[Unknown]]`, found `dict[Unknown | str, Unknown | list[Unknown | str]]`
+ rotkehlchen/tests/unit/test_tokens.py:202:9: error[invalid-argument-type] Argument to function `generate_multicall_chunks` is incorrect: Expected `Mapping[ChecksumAddress, Sequence[Unknown]]`, found `dict[str, Unknown | list[Unknown | str]]`

sympy (https://github.com/sympy/sympy)
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
+ sympy/core/tests/test_subs.py:558:12: error[no-matching-overload] No overload of bound method `subs` matches arguments
- sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/functions/combinatorial/factorials.py:968:29: warning[possibly-missing-attribute] Attribute `is_nonnegative` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:968:47: warning[possibly-missing-attribute] Attribute `is_integer` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:969:12: warning[possibly-missing-attribute] Attribute `is_zero` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:975:12: warning[possibly-missing-attribute] Attribute `is_integer` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:976:16: warning[possibly-missing-attribute] Attribute `is_negative` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:978:18: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:984:14: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/geometry/polygon.py:1500:12: warning[possibly-missing-attribute] Attribute `is_Number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/geometry/polygon.py:1501:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic | int | float | complex | Any`
+ sympy/geometry/polygon.py:1501:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/geometry/polygon.py:1502:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[3]`
+ sympy/geometry/polygon.py:1502:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic` and `Literal[3]`
- sympy/geometry/polygon.py:1509:40: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:263:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:263:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:298:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:298:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:298:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:298:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:707:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:707:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
- sympy/physics/optics/gaussopt.py:756:8: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:756:25: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:757:21: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:759:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:759:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:759:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:759:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:790:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:790:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic`
- sympy/physics/optics/gaussopt.py:837:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:837:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
- sympy/physics/optics/gaussopt.py:837:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:837:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:837:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:837:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic`
- sympy/physics/optics/gaussopt.py:838:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:838:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:838:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:838:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:839:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:839:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:839:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:839:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:887:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:887:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/quantum/cg.py:83:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/physics/quantum/cg.py:258:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/physics/quantum/cg.py:347:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5997:12: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5997:31: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5997:51: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5997:70: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5998:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:5998:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/polys/polytools.py:6127:12: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6127:31: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6127:51: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6127:70: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6128:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6128:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/series/formal.py:987:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/series/fourier.py:146:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/simplify/sqrtdenest.py:430:25: warning[possibly-missing-attribute] Attribute `subs` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:361:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:361:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:362:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:362:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:363:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:363:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:363:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:363:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:363:62: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:363:62: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:363:70: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:363:70: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:365:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/stats/tests/test_finite_rv.py:365:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic` and `Literal[2]`
- sympy/stats/tests/test_finite_rv.py:365:30: error[unsupported-operator] Operator `<` is not supported between objects of type `Literal[0]` and `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:365:30: error[unsupported-operator] Operator `<` is not supported between objects of type `Literal[0]` and `Basic`
- sympy/stats/tests/test_finite_rv.py:365:34: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:365:34: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:365:44: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:365:44: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:366:57: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:366:57: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic`
- sympy/stats/tests/test_finite_rv.py:366:67: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:366:67: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:366:79: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:366:79: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic`
- sympy/stats/tests/test_finite_rv.py:367:33: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:367:33: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:367:38: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:367:38: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:367:46: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:367:46: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:367:55: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/stats/tests/test_finite_rv.py:367:55: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[2]`
- Found 16059 diagnostics
+ Found 16034 diagnostics

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/frame/test_frame.py:3238:34: error[missing-typed-dict-key] Missing required key 'formats' in TypedDict `_DTypeDict` constructor
+ tests/frame/test_frame.py:3238:34: error[missing-typed-dict-key] Missing required key 'names' in TypedDict `_DTypeDict` constructor
+ tests/frame/test_frame.py:3238:35: error[invalid-key] Unknown key "col1" for TypedDict `_DTypeDict`: Unknown key "col1"
+ tests/frame/test_frame.py:3238:52: error[invalid-key] Unknown key "col2" for TypedDict `_DTypeDict`: Unknown key "col2"
- tests/indexes/test_indexes.py:1573:11: error[type-assertion-failure] Type `Index[Any]` does not match asserted type `Unknown`
+ tests/indexes/test_indexes.py:1573:11: error[type-assertion-failure] Type `Index[Any]` does not match asserted type `DatetimeIndex`
- tests/test_styler.py:167:17: error[invalid-argument-type] Argument to bound method `set_table_styles` is incorrect: Expected `dict[Unknown, list[CSSDict]] | list[CSSDict] | None`, found `list[Unknown | dict[Unknown | str, Unknown | str | list[Unknown | tuple[str, str]]]]`
- Found 4508 diagnostics
+ Found 4511 diagnostics

core (https://github.com/home-assistant/core)
- homeassistant/components/min_max/sensor.py:260:57: error[invalid-assignment] Object of type `Event[dict[str, Unknown | str | State | None]]` is not assignable to `Event[EventStateChangedData]`
+ homeassistant/components/min_max/sensor.py:260:57: error[invalid-assignment] Object of type `Event[dict[Unknown | str, Unknown | str | State | None]]` is not assignable to `Event[EventStateChangedData]`
- homeassistant/util/hass_dict.pyi:146:5: error[type-assertion-failure] Type `dict[str, int]` does not match asserted type `dict[str, int | Unknown]`
- homeassistant/util/hass_dict.pyi:147:5: error[type-assertion-failure] Type `int` does not match asserted type `int | Unknown`
- homeassistant/util/hass_dict.pyi:149:5: error[type-assertion-failure] Type `dict[int, bool]` does not match asserted type `dict[int, bool] | dict[Unknown, Unknown]`
+ homeassistant/util/hass_dict.pyi:149:5: error[type-assertion-failure] Type `dict[int, bool]` does not match asserted type `dict[int, bool] | (dict[Unknown, Unknown] & dict[str, Unknown])`
- homeassistant/util/hass_dict.pyi:155:62: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- homeassistant/util/hass_dict.pyi:176:5: error[type-assertion-failure] Type `dict[int, bool]` does not match asserted type `dict[int, bool] | dict[Unknown, Unknown]`
+ homeassistant/util/hass_dict.pyi:176:5: error[type-assertion-failure] Type `dict[int, bool]` does not match asserted type `dict[int, bool] | (dict[Unknown, Unknown] & dict[str, Unknown])`
- Found 14569 diagnostics
+ Found 14566 diagnostics

No memory usage changes detected ✅

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 19, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 6.14%

Comparing ibraheem/partial-tcx (4164dfb) with main (05eb384)

Summary

❌ 2 regressed benchmarks
✅ 22 untouched benchmarks
⏩ 30 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime colour_science 94.3 s 99.4 s -5.12%
WallTime freqtrade 7.9 s 8.4 s -6.14%

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.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 19, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
unsupported-operator 84 1 50
not-subscriptable 96 1 0
possibly-missing-attribute 5 29 36
invalid-argument-type 20 9 11
no-matching-overload 1 21 0
invalid-assignment 0 1 6
invalid-parameter-default 0 0 7
type-assertion-failure 0 2 3
invalid-return-type 0 1 3
invalid-await 0 2 0
invalid-key 2 0 0
missing-typed-dict-key 2 0 0
not-iterable 0 0 2
unresolved-attribute 0 0 2
unused-type-ignore-comment 1 1 0
Total 211 68 120

Full report with detailed diff (timing results)

@ibraheemdev ibraheemdev marked this pull request as draft January 20, 2026 01:18
Base automatically changed from ibraheem/bidi-diagnostics to main January 26, 2026 22:47
@ibraheemdev ibraheemdev force-pushed the ibraheem/partial-tcx branch 2 times, most recently from 31b6cfb to a00f795 Compare January 28, 2026 23:54
@ibraheemdev ibraheemdev marked this pull request as ready for review January 28, 2026 23:55
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effect on the tests here looks great!

Have you done any analysis of ecosystem hits?

I do have some questions about the approach in this PR, mentioned inline. if it's easier, we could discuss on a call tomorrow.

@ibraheemdev ibraheemdev force-pushed the ibraheem/partial-tcx branch 2 times, most recently from 92188b5 to b8cb109 Compare February 6, 2026 02:11
@ibraheemdev
Copy link
Member Author

I updated the PR to use a unique marker type to represent unspecialized type variables. This should never end up in any inferred types because of the has_unspecialized_type_var checks in places where we infer from the type context.

@carljm
Copy link
Contributor

carljm commented Feb 6, 2026

Looks like there is a performance regression across a number of projects. Have you looked into that at all? Any sense of whether it's because we get better/more types, or if there's something expensive we are doing here?

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just curious if there's any way we can reduce the perf impact.

@ibraheemdev
Copy link
Member Author

colour-science and freqtrade seem to be affected by +/-5% in just about every PR I have made that touches generic call inference, I don't really understand why. I'm not sure there's much actionable here.

@ibraheemdev ibraheemdev merged commit a952e14 into main Feb 6, 2026
49 of 50 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/partial-tcx branch February 6, 2026 22:29
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.

3 participants