Skip to content

[ty] Update SpecializationBuilder hook to get both lower/upper bounds#23848

Draft
dcreager wants to merge 9 commits intomainfrom
dcreager/solutions-hook
Draft

[ty] Update SpecializationBuilder hook to get both lower/upper bounds#23848
dcreager wants to merge 9 commits intomainfrom
dcreager/solutions-hook

Conversation

@dcreager
Copy link
Member

@dcreager dcreager commented Mar 10, 2026

This is a refactoring in support of astral-sh/ty#2799. The eventual goal is to use a ConstraintSet to hold the pending specialization being built in SpecializationBuilder. That will automatically cause us to combine mappings with union or intersection as appropriate.

This PR removes several methods from the SpecializationBuilder API:

  • mapped is removed in favor of a new build_with that applies the mapping while constructing the specialization. The callback is updated to receive the typevar's lower/upper bound from (eventually) the constraint set solution. (For now, we just give it both types from the pending hash map.)

  • infer_reverse and friends are removed in favor of constructing a constraint set directly via when_constraint_set_assignable_to. The reverse inference was used to apply our inference logic with the formal/actual reversed. Constraint set assignability handles that just fine.

  • type_mappings and into_type_mappings are also removed. These were used to consume the resut of the infer_reverse calls. We can replace that by consuming the constraint set created by the assignability check. This requires a solutions wrapper that takes in a similar hook callback as above.

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

astral-sh-bot bot commented Mar 10, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 85.05%. The percentage of expected errors that received a diagnostic held steady at 78.05%. The number of fully passing files held steady at 63/132.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 10, 2026

mypy_primer results

Changes were detected when running on open source projects
aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:4114:55: error[invalid-assignment] Object of type `dict[bytes | str | memoryview[int], Any | None]` is not assignable to `dict[bytes | str | memoryview[int], (dict[str, str], /) -> Awaitable[None]]`
+ aioredis/client.py:4114:55: error[invalid-assignment] Object of type `dict[Unknown, Any | None]` is not assignable to `dict[bytes | str | memoryview[int], (dict[str, str], /) -> Awaitable[None]]`

anyio (https://github.com/agronholm/anyio)
- src/anyio/_core/_fileio.py:190:22: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `IO[str]`, found `TextIOWrapper[_WrappedBuffer] | BinaryIO | IO[Any]`
- src/anyio/_core/_fileio.py:634:26: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `IO[str]`, found `TextIOWrapper[_WrappedBuffer] | BinaryIO | IO[Any]`
- Found 92 diagnostics
+ Found 90 diagnostics

paasta (https://github.com/yelp/paasta)
- paasta_tools/tron_tools.py:572:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, FieldSelectorConfig]`, found `dict[str, FieldSelectorConfig | dict[str, str]]`
+ paasta_tools/tron_tools.py:572:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, FieldSelectorConfig]`, found `dict[str | FieldSelectorConfig, FieldSelectorConfig | dict[str, str]]`

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- bson/json_util.py:1002:9: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `(Any, JSONOptions, /) -> Any` on object of type `dict[int, (Any, JSONOptions, /) -> Any]`
+ bson/json_util.py:1002:9: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `type | ((Any, JSONOptions, /) -> Any)` on object of type `dict[int, (Any, JSONOptions, /) -> Any]`

xarray (https://github.com/pydata/xarray)
- xarray/core/groupby.py:501:36: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `DataArray`, found `T_DataWithCoords@_resolve_group`
- Found 1713 diagnostics
+ Found 1712 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/concurrency/api.py:41:16: error[invalid-return-type] Return type does not match returned value: expected `Call[T@cast_to_call]`, found `Call[Awaitable[T@cast_to_call] | T@cast_to_call]`
+ src/prefect/runtime/flow_run.py:70:5: error[invalid-assignment] Object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | ... omitted 3 union elements, ((x) -> Unknown) | <class 'int'> | <class 'float'> | <class 'str'> | ((dt: str) -> datetime)]` is not assignable to `dict[type[int | float | str | Unknown] | <class 'NoneType'>, (Any, /) -> Any]`
- Found 5890 diagnostics
+ Found 5892 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- setup.py:1291:5: error[invalid-argument-type] Argument to function `setup` is incorrect: Expected `_MutableDictLike[str, type[Command]]`, found `dict[str, <class 'CustomBuildExt'> | <class 'LibraryDownloader'> | <class 'CustomBuildRust'> | <class 'CleanLibraries'> | <class 'ExtensionHashes'>]`
- Found 9284 diagnostics
+ Found 9283 diagnostics

ibis (https://github.com/ibis-project/ibis)
- ibis/backends/athena/__init__.py:583:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/athena/__init__.py:583:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/bigquery/datatypes.py:67:27: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/bigquery/datatypes.py:67:27: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, DataType]`
- ibis/backends/bigquery/tests/unit/test_compiler.py:273:26: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/bigquery/tests/unit/test_compiler.py:273:26: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/backends/databricks/__init__.py:82:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/databricks/__init__.py:82:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Any, DataType]`
- ibis/backends/databricks/__init__.py:608:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/databricks/__init__.py:608:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/databricks/tests/test_datatypes.py:19:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/databricks/tests/test_datatypes.py:19:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str | Struct]`
- ibis/backends/datafusion/__init__.py:544:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/datafusion/__init__.py:544:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, DataType]`
- ibis/backends/duckdb/__init__.py:340:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/duckdb/__init__.py:340:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/duckdb/__init__.py:1734:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/duckdb/__init__.py:1734:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/exasol/__init__.py:274:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/exasol/__init__.py:274:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/flink/tests/test_ddl.py:262:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/flink/tests/test_ddl.py:262:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Unknown]`
- ibis/backends/flink/tests/test_ddl.py:456:30: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/flink/tests/test_ddl.py:456:30: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Int64 | Float64]`
- ibis/backends/flink/tests/test_ddl.py:484:34: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/flink/tests/test_ddl.py:484:34: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Int64]`
- ibis/backends/flink/tests/test_ddl.py:486:24: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/flink/tests/test_ddl.py:486:24: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Int64 | Float64]`
- ibis/backends/materialize/__init__.py:395:17: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/materialize/__init__.py:395:17: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/materialize/__init__.py:438:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/materialize/__init__.py:438:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/oracle/tests/test_datatypes.py:29:45: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/oracle/tests/test_datatypes.py:29:45: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/backends/oracle/tests/test_datatypes.py:53:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/oracle/tests/test_datatypes.py:53:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/backends/polars/rewrites.py:33:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/polars/rewrites.py:33:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, DataType]`
- ibis/backends/postgres/__init__.py:497:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/postgres/__init__.py:497:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/risingwave/__init__.py:309:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/risingwave/__init__.py:309:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/snowflake/__init__.py:575:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/snowflake/__init__.py:575:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/snowflake/__init__.py:591:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/snowflake/__init__.py:591:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/sqlite/__init__.py:276:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/sqlite/__init__.py:276:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Any, DataType]`
- ibis/backends/tests/test_join.py:214:57: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/tests/test_join.py:214:57: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/backends/trino/__init__.py:184:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/trino/__init__.py:184:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/backends/trino/__init__.py:345:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/backends/trino/__init__.py:345:13: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown | DataType]`
- ibis/expr/tests/test_api.py:20:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_api.py:20:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/expr/tests/test_format.py:366:24: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_format.py:366:24: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[str, Unknown]`
- ibis/expr/tests/test_newrels.py:66:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:66:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Boolean | Int64 | Float64 | String]`
- ibis/expr/tests/test_newrels.py:86:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:86:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64]`
- ibis/expr/tests/test_newrels.py:91:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:91:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64]`
- ibis/expr/tests/test_newrels.py:96:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:96:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64]`
- ibis/expr/tests/test_newrels.py:107:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:107:39: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64]`
- ibis/expr/tests/test_newrels.py:116:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_newrels.py:116:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int8 | Float64 | Int32]`
- ibis/expr/tests/test_schema.py:124:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:124:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Float64 | Boolean]`
- ibis/expr/tests/test_schema.py:181:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:181:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/expr/tests/test_schema.py:233:5: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:233:5: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/expr/tests/test_schema.py:326:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:326:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | Array[Unknown]]`
- ibis/expr/tests/test_schema.py:334:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:334:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Int64 | Float64]`
- ibis/expr/tests/test_schema.py:335:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:335:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Float64 | Boolean | Date]`
- ibis/expr/tests/test_schema.py:336:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:336:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | Float64 | String]`
- ibis/expr/tests/test_schema.py:337:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:337:20: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | Float64 | String | Boolean]`
- ibis/expr/tests/test_schema.py:339:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:339:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Float64]`
- ibis/expr/tests/test_schema.py:341:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:341:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, String | Int64 | Float64 | Boolean | Date]`
- ibis/expr/tests/test_schema.py:343:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:343:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64]`
- ibis/expr/tests/test_schema.py:344:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:344:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Boolean | Date]`
- ibis/expr/tests/test_schema.py:345:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:345:32: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | Boolean | Date]`
- ibis/expr/tests/test_schema.py:374:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:374:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Boolean]`
- ibis/expr/tests/test_schema.py:385:30: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:385:30: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Boolean]`
- ibis/expr/tests/test_schema.py:402:38: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:402:38: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Boolean]`
- ibis/expr/tests/test_schema.py:431:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:431:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Timestamp]`
- ibis/expr/tests/test_schema.py:594:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/expr/tests/test_schema.py:594:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | Int32 | Int16 | ... omitted 14 union elements]`
- ibis/expr/types/generic.py:1554:35: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[Unknown, Unknown]`
+ ibis/expr/types/generic.py:1554:35: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[Unknown, Value[Unknown, Any]]`
- ibis/expr/types/generic.py:1774:35: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[Unknown, Unknown]`
+ ibis/expr/types/generic.py:1774:35: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, Value[Unknown, Any]]`, found `dict[Unknown, Value[Unknown, Any]]`
- ibis/formats/pandas.py:168:55: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/pandas.py:168:55: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Unknown]`
- ibis/formats/polars.py:156:43: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/polars.py:156:43: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, DataType]`
- ibis/formats/polars.py:162:43: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/polars.py:162:43: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, DataType]`
- ibis/formats/tests/test_pandas.py:125:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/tests/test_pandas.py:125:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Boolean | Float64]`
- ibis/formats/tests/test_pandas.py:152:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/tests/test_pandas.py:152:9: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Int64 | String | Boolean | Float64]`
- ibis/formats/tests/test_pandas.py:441:27: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/tests/test_pandas.py:441:27: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, Unknown]`
- ibis/formats/tests/test_pandas.py:457:25: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/formats/tests/test_pandas.py:457:25: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/tests/expr/test_table.py:1161:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/tests/expr/test_table.py:1161:28: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`
- ibis/tests/expr/test_table.py:1224:29: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[Unknown, Unknown]`
+ ibis/tests/expr/test_table.py:1224:29: error[invalid-argument-type] Argument is incorrect: Expected `FrozenOrderedDict[str, DataType]`, found `dict[str, str]`

pandas (https://github.com/pandas-dev/pandas)
- pandas/tests/io/formats/style/test_style.py:781:9: error[invalid-assignment] Object of type `dict[tuple[int, int], list[tuple[str, str | int | float]]]` is not assignable to attribute `ctx` of type `defaultdict[tuple[int, int], list[tuple[str, str | int | float]]]`
- pandas/tests/io/formats/style/test_style.py:793:9: error[invalid-assignment] Object of type `dict[tuple[int, int], list[tuple[str, str | int | float]]]` is not assignable to attribute `ctx` of type `defaultdict[tuple[int, int], list[tuple[str, str | int | float]]]`
+ pandas/tests/io/formats/style/test_style.py:781:9: error[invalid-assignment] Object of type `dict[tuple[int, int], list[tuple[str, str]]]` is not assignable to attribute `ctx` of type `defaultdict[tuple[int, int], list[tuple[str, str | int | float]]]`
+ pandas/tests/io/formats/style/test_style.py:793:9: error[invalid-assignment] Object of type `dict[tuple[int, int], list[tuple[str, str]]]` is not assignable to attribute `ctx` of type `defaultdict[tuple[int, int], list[tuple[str, str | int | float]]]`

core (https://github.com/home-assistant/core)
+ homeassistant/core.py:624:43: error[invalid-argument-type] Argument to bound method `async_create_task` is incorrect: Expected `Coroutine[Any, Any, _R@async_add_job]`, found `(((...) -> Coroutine[Any, Any, _R@async_add_job] | _R@async_add_job) & Coroutine[object, Never, object]) | Coroutine[Any, Any, _R@async_add_job]`
+ homeassistant/core.py:951:43: error[invalid-argument-type] Argument to bound method `async_create_task` is incorrect: Expected `Coroutine[Any, Any, _R@async_run_job]`, found `(((...) -> Coroutine[Any, Any, _R@async_run_job] | _R@async_run_job) & Coroutine[object, Never, object]) | Coroutine[Any, Any, _R@async_run_job]`
+ homeassistant/helpers/service.py:918:18: error[invalid-assignment] Object of type `object` is not assignable to `ServiceResponse`
- Found 12091 diagnostics
+ Found 12094 diagnostics

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/arrays/test_base_string_.py:100:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:103:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:106:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:109:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:112:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:115:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:118:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:123:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:126:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
+ tests/arrays/test_base_string_.py:143:11: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `BaseStringArray[None]`
- tests/arrays/test_string_.py:41:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:41:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:44:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:44:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:47:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:47:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:50:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:50:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:53:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:53:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:56:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:56:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:59:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:59:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:67:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:67:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_.py:72:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `StringArray`
+ tests/arrays/test_string_.py:72:9: error[type-assertion-failure] Type `ArrowStringArray` does not match asserted type `StringArray`
- tests/arrays/test_string_arrow.py:39:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:42:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:45:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:48:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:51:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:56:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:61:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:69:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
- tests/arrays/test_string_arrow.py:77:9: error[type-assertion-failure] Type `BaseStringArray[None]` does not match asserted type `ArrowStringArray`
+ tests/frame/test_frame.py:3813:9: error[type-assertion-failure] Type `Unknown` is not equivalent to `Never`
+ tests/test_groupby.py:137:9: error[type-assertion-failure] Type `Unknown` does not match asserted type `DataFrame`
+ tests/test_groupby.py:138:13: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:138:13: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:138:13: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:168:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:168:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:168:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:172:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:172:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:172:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:176:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:176:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_groupby.py:176:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_resampler.py:109:9: error[type-assertion-failure] Type `Unknown` does not match asserted type `DataFrame`
+ tests/test_resampler.py:110:13: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_resampler.py:402:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_resampler.py:406:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
+ tests/test_resampler.py:410:9: error[no-matching-overload] No overload of bound method `aggregate` matches arguments
- Found 4759 diagnostics
+ Found 4779 diagnostics

meson (https://github.com/mesonbuild/meson)
- mesonbuild/cmake/interpreter.py:1013:70: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `str | int | Path | BaseNode`
+ mesonbuild/mparser.py:683:47: error[invalid-assignment] Object of type `dict[str, str]` is not assignable to `Mapping[str, Literal["==", "!=", "<", "<=", ">=", ... omitted 3 literals]]`
+ mesonbuild/mparser.py:694:47: error[invalid-assignment] Object of type `dict[str, str]` is not assignable to `Mapping[str, Literal["+", "-", "*", "/", "%"]]`
+ mesonbuild/mparser.py:699:47: error[invalid-assignment] Object of type `dict[str, str]` is not assignable to `Mapping[str, Literal["+", "-", "*", "/", "%"]]`
- mesonbuild/mparser.py:725:65: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `None`
- Found 2356 diagnostics
+ Found 2357 diagnostics

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 10, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 701.92MB 702.24MB +0.04% (319.82kB)
sphinx 265.18MB 265.33MB +0.06% (155.29kB)
flake8 47.90MB 47.92MB +0.04% (19.44kB)
trio 117.80MB 117.73MB -0.05% (65.77kB) ⬇️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
IntersectionType<'db>::from_two_elements_ 341.24kB 387.32kB +13.51% (46.09kB)
UnionType<'db>::from_two_elements_::interned_arguments 2.37MB 2.41MB +1.86% (45.20kB)
is_redundant_with_impl::interned_arguments 5.34MB 5.38MB +0.79% (42.97kB)
IntersectionType<'db>::from_two_elements_::interned_arguments 345.47kB 387.06kB +12.04% (41.59kB)
UnionType<'db>::from_two_elements_ 5.14MB 5.18MB +0.74% (39.03kB)
is_redundant_with_impl 5.55MB 5.58MB +0.55% (31.52kB)
infer_definition_types 88.46MB 88.49MB +0.03% (30.61kB)
UnionType 3.45MB 3.47MB +0.48% (16.84kB)
StaticClassLiteral<'db>::try_mro_ 6.03MB 6.04MB +0.26% (15.86kB)
CallableType 1.89MB 1.90MB +0.62% (12.09kB)
Type<'db>::try_call_dunder_get_ 10.44MB 10.43MB -0.11% (11.97kB)
infer_expression_types_impl 60.42MB 60.43MB +0.02% (10.41kB)
IntersectionType 2.30MB 2.31MB +0.43% (10.09kB)
Type<'db>::class_member_with_policy_ 17.22MB 17.21MB -0.06% (9.80kB)
Type<'db>::class_member_with_policy_::interned_arguments 9.32MB 9.31MB -0.09% (9.04kB)
... 54 more

sphinx

Name Old New Diff Outcome
IntersectionType<'db>::from_two_elements_ 204.30kB 243.77kB +19.32% (39.47kB)
IntersectionType<'db>::from_two_elements_::interned_arguments 173.08kB 208.57kB +20.51% (35.49kB)
UnionType<'db>::from_two_elements_::interned_arguments 742.07kB 767.85kB +3.47% (25.78kB)
is_redundant_with_impl::interned_arguments 2.06MB 2.08MB +0.94% (19.85kB)
is_redundant_with_impl 1.80MB 1.82MB +1.07% (19.60kB)
UnionType<'db>::from_two_elements_ 1.35MB 1.37MB +1.34% (18.47kB)
infer_definition_types 24.00MB 24.01MB +0.04% (8.99kB)
StaticClassLiteral<'db>::try_mro_ 2.11MB 2.11MB +0.33% (7.10kB)
infer_scope_types_impl 15.59MB 15.58MB -0.03% (4.68kB)
inferable_typevars_inner 81.07kB 76.74kB -5.34% (4.33kB)
IntersectionType 893.35kB 897.58kB +0.47% (4.23kB)
infer_unpack_types 446.68kB 442.85kB -0.86% (3.83kB)
check_file_impl 5.13MB 5.13MB +0.07% (3.72kB)
Specialization 1.02MB 1.02MB +0.31% (3.22kB)
GenericAlias<'db>::variance_of_::interned_arguments 9.00kB 5.98kB -33.59% (3.02kB)
... 48 more

flake8

Name Old New Diff Outcome
IntersectionType<'db>::from_two_elements_ 19.44kB 23.50kB +20.90% (4.06kB)
IntersectionType<'db>::from_two_elements_::interned_arguments 20.62kB 24.32kB +17.92% (3.70kB)
is_redundant_with_impl 140.46kB 143.40kB +2.09% (2.94kB)
UnionType<'db>::from_two_elements_::interned_arguments 48.04kB 50.70kB +5.55% (2.66kB)
Type<'db>::class_member_with_policy_ 547.17kB 549.61kB +0.45% (2.44kB)
StaticClassLiteral<'db>::try_mro_ 335.69kB 337.89kB +0.66% (2.20kB)
inferable_typevars_inner 26.00kB 23.91kB -8.07% (2.10kB)
Type<'db>::try_call_dunder_get_ 373.83kB 375.76kB +0.52% (1.93kB)
UnionType<'db>::from_two_elements_ 80.87kB 82.62kB +2.17% (1.75kB)
infer_expression_types_impl 1.07MB 1.07MB +0.15% (1.61kB)
is_redundant_with_impl::interned_arguments 140.51kB 141.88kB +0.98% (1.38kB)
Type<'db>::class_member_with_policy_::interned_arguments 300.32kB 301.64kB +0.44% (1.32kB)
infer_scope_types_impl 1004.28kB 1003.05kB -0.12% (1.23kB)
Type<'db>::member_lookup_with_policy_ 409.16kB 410.25kB +0.27% (1.09kB)
GenericContext 44.57kB 43.64kB -2.09% (952.00B)
... 41 more

trio

Name Old New Diff Outcome
FunctionType 1.50MB 1.49MB -0.79% (12.16kB) ⬇️
IntersectionType<'db>::from_two_elements_ 65.13kB 76.88kB +18.03% (11.74kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 863.60kB 852.50kB -1.28% (11.09kB) ⬇️
IntersectionType<'db>::from_two_elements_::interned_arguments 59.55kB 70.12kB +17.75% (10.57kB) ⬇️
is_redundant_with_impl::interned_arguments 538.83kB 548.54kB +1.80% (9.71kB) ⬇️
CallableType 572.79kB 563.71kB -1.58% (9.07kB) ⬇️
Type<'db>::class_member_with_policy_ 1.98MB 1.97MB -0.41% (8.39kB) ⬇️
UnionType<'db>::from_two_elements_::interned_arguments 155.98kB 163.88kB +5.07% (7.91kB) ⬇️
infer_expression_types_impl 7.06MB 7.05MB -0.09% (6.63kB) ⬇️
Specialization 474.62kB 468.06kB -1.38% (6.56kB) ⬇️
is_redundant_with_impl 479.04kB 485.14kB +1.27% (6.11kB) ⬇️
UnionType<'db>::from_two_elements_ 272.48kB 278.43kB +2.18% (5.95kB) ⬇️
Type<'db>::try_call_dunder_get_ 1.37MB 1.37MB -0.41% (5.76kB) ⬇️
infer_expression_type_impl 1.43MB 1.42MB -0.34% (4.90kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 1.10MB 1.10MB -0.41% (4.57kB) ⬇️
... 45 more

@dcreager dcreager force-pushed the dcreager/solutions-hook branch from bdbe546 to 38c8dc4 Compare March 10, 2026 00:47
@dcreager dcreager marked this pull request as ready for review March 10, 2026 00:51
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 10, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 2 6 64
type-assertion-failure 13 9 9
no-matching-overload 16 0 0
invalid-assignment 5 0 4
invalid-return-type 1 0 1
Total 37 15 78

Full report with detailed diff (timing results)

@carljm carljm removed their request for review March 10, 2026 01:00
@dcreager dcreager marked this pull request as draft March 10, 2026 01:06
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 10, 2026

Merging this PR will degrade performance by 19.79%

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

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime tanjun 2.8 s 2.9 s -4.12%
WallTime pydantic 6.1 s 7.6 s -19.79%

Comparing dcreager/solutions-hook (00641b7) with main (055fb30)

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.

@dcreager
Copy link
Member Author

Looking at some selected ecosystem results:

  • ibis: [all correct] All of the changes are because we are now infering more precise dict types. Root cause is how FrozenOrderedDict indirectly inherits from bare dict. That means the specialization of FrozenOrderedDict does not influence the specialization of dict's _KT and _VT typevars. The old infer_reverse logic incorrectly inferred those to be Unknown, since the bare dict in the base class list becomes the default/unknown specialization. Constraint set assignability correctly ignores that case, allowing us to infer the specialization from the type context.

@dcreager
Copy link
Member Author

  • aioredis: This is an interesting one. This ends up checking whether dict[_T, Any | None] (the result of dict.fromkeys) is assignable to dict[..., Callable[[], None]] (the assignment annotation). This is not satisfiable, since Any | None is not assignable to Callable[[], None]. The old infer_reverse solver would still pull out a _T = ... mapping. The new solver does not, so we end up with _T = Unknown. And that propagates through to the types shown in the diagnostic. I would argue that this is at least a "fine for now", if not a genuinely better message.

@dcreager
Copy link
Member Author

  • mesonbuild additions: looks like (literal) promotion is kicking in here where arguably it shouldn't

@dcreager
Copy link
Member Author

The codspeed regression, and 25× perf regression in mesonbuild, both are because infer_reverse would purposefully skip some of the more expensive infer branches. Switch to an actual assignability check engages all of those branches again. And this hits the usual "protocols with big overloads" performance problem. I have a different PR that is looking at that in isolation. Pausing this until that lands...

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.

2 participants