Skip to content

[ty] Infer lambda parameter types with Callable type context#24317

Open
ibraheemdev wants to merge 5 commits intomainfrom
ibraheem/callable-tcx
Open

[ty] Infer lambda parameter types with Callable type context#24317
ibraheemdev wants to merge 5 commits intomainfrom
ibraheem/callable-tcx

Conversation

@ibraheemdev
Copy link
Copy Markdown
Member

@ibraheemdev ibraheemdev commented Mar 30, 2026

Improves #22633 to infer the use of lambda parameters in a lambda body with type context, e.g.,

x: Callable[[str], str] = lambda x: reveal_type(x)  # revealed: str
reveal_type(x)  # revealed: (x: str) -> str

Unlike other definitions, lambda parameter types cannot be determined purely syntactically in semantic indexing. Instead, they depend on the inferred type of the lambda to access its parameter types. Unfortunately, this makes lambda inference cyclic, as the body of the lambda depends on the outer lambda type, and there is no obvious way of splitting out inference of the lambda parameter types from its return type.

To avoid initiating cycles on the entire scope containing the lambda, this PR introduces a new inference query — statement-level inference. Statements are a minimal unit of code that encapsulate any internal type context. This makes them very useful to infer a given sub-expression "naturally" without having to provide any external type context. There are other places where we currently rely on scope-level inference for this purpose (e.g., see infer_complete_scope_types, the current implementation of #23761, and the discussion in astral-sh/ty#3124). Note that statement-level inference is not perfectly fine-grained, e.g., the test expression of an if statement does not require external type context and is independent from its body, so statement-level inference may lead to unnecessarily large cycles, but having the unit of code being generalized to an AST structure allows us to avoid the need for such special cases, but this can always change in the future.

Additionally, many statements are simply wrappers around definitions or standalone expressions, so we can avoid extra salsa allocations in the common case.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Mar 30, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 30, 2026

Typing conformance results

No changes detected ✅

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

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 30, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 715.72MB 720.44MB +0.66% (4.73MB)
sphinx 263.86MB 264.89MB +0.39% (1.03MB)
trio 117.51MB 117.95MB +0.37% (446.76kB)
flake8 47.93MB 48.13MB +0.43% (210.62kB)

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
Definition 20.77MB 22.65MB +9.09% (1.89MB)
infer_definition_types 89.62MB 90.66MB +1.15% (1.03MB)
infer_scope_types_impl 54.10MB 54.91MB +1.50% (831.55kB)
infer_expression_types_impl 61.71MB 62.08MB +0.60% (377.81kB)
infer_statement_types_impl 0.00B 220.81kB +220.81kB (new)
semantic_index 172.36MB 172.51MB +0.09% (155.78kB)
infer_expression_type_impl 13.32MB 13.47MB +1.07% (146.57kB)
infer_unpack_types 896.43kB 964.87kB +7.63% (68.44kB)
all_narrowing_constraints_for_expression 7.17MB 7.19MB +0.30% (22.26kB)
all_negative_narrowing_constraints_for_expression 2.63MB 2.64MB +0.44% (11.85kB)
StatementInner 0.00B 8.09kB +8.09kB (new)
is_redundant_with_impl::interned_arguments 5.42MB 5.42MB +0.01% (704.00B)
StaticClassLiteral<'db>::implicit_attribute_inner_ 10.00MB 10.00MB +0.01% (704.00B)
Type<'db>::member_lookup_with_policy_ 16.37MB 16.37MB +0.00% (544.00B)
UnionType 3.52MB 3.52MB +0.01% (480.00B)
... 7 more

sphinx

Name Old New Diff Outcome
Definition 8.13MB 8.87MB +9.09% (757.16kB)
infer_scope_types_impl 15.48MB 15.60MB +0.72% (113.82kB)
infer_definition_types 23.82MB 23.91MB +0.36% (87.88kB)
semantic_index 61.06MB 61.12MB +0.10% (61.88kB)
infer_statement_types_impl 0.00B 19.69kB +19.69kB (new)
infer_expression_types_impl 20.94MB 20.94MB +0.03% (6.23kB)
infer_expression_type_impl 2.93MB 2.94MB +0.12% (3.69kB)
StatementInner 0.00B 840.00B +840.00B (new)
CallableType 1.11MB 1.11MB +0.04% (504.00B)
Type<'db>::apply_specialization_ 1.65MB 1.65MB +0.03% (472.00B)
Type<'db>::apply_specialization_::interned_arguments 1.46MB 1.46MB +0.03% (400.00B)
Specialization 1.03MB 1.03MB +0.03% (304.00B)
all_narrowing_constraints_for_expression 2.34MB 2.34MB +0.00% (84.00B)
all_negative_narrowing_constraints_for_expression 1.00MB 1.00MB +0.01% (84.00B)
GenericAlias 450.70kB 450.77kB +0.02% (72.00B)
... 3 more

trio

Name Old New Diff Outcome
Definition 4.00MB 4.36MB +9.09% (371.93kB)
infer_statement_types_impl 0.00B 24.27kB +24.27kB (new)
semantic_index 29.95MB 29.97MB +0.07% (21.34kB)
infer_definition_types 7.63MB 7.64MB +0.22% (16.98kB)
infer_scope_types_impl 4.77MB 4.78MB +0.10% (4.75kB)
infer_expression_types_impl 7.03MB 7.03MB +0.04% (3.12kB)
infer_expression_type_impl 1.31MB 1.31MB +0.17% (2.21kB)
all_narrowing_constraints_for_expression 591.53kB 592.74kB +0.20% (1.21kB)
StatementInner 0.00B 952.00B +952.00B (new)
function_known_decorators 922.11kB 922.13kB +0.00% (24.00B)

flake8

Name Old New Diff Outcome
Definition 1.98MB 2.16MB +9.09% (183.91kB)
semantic_index 13.70MB 13.71MB +0.07% (9.20kB)
infer_statement_types_impl 0.00B 5.96kB +5.96kB (new)
infer_definition_types 1.87MB 1.87MB +0.28% (5.32kB)
infer_expression_types_impl 1.05MB 1.05MB +0.31% (3.32kB)
infer_scope_types_impl 992.99kB 995.75kB +0.28% (2.75kB)
StatementInner 0.00B 168.00B +168.00B (new)

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 30, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-await 0 40 0
unresolved-attribute 28 0 0
invalid-argument-type 19 0 4
unused-type-ignore-comment 2 15 0
unsupported-operator 14 0 0
not-subscriptable 13 0 0
invalid-assignment 4 1 4
invalid-return-type 0 4 0
Total 80 60 8

Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.

Raw diff (97 changes)
Expression (https://github.com/cognitedata/Expression)
+ expression/extra/parser.py:160:56 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Parser[_A@choice]`
- tests/test_result.py:535:26 error[invalid-argument-type] Argument to bound method `or_else_with` is incorrect: Expected `(Literal["original error"], /) -> Result[Any, Literal["original error"]]`, found `(error: Literal["original error"]) -> Result[Any, str]`
+ tests/test_result.py:535:26 error[invalid-argument-type] Argument to bound method `or_else_with` is incorrect: Expected `(Literal["original error"], /) -> Result[Any, Literal["original error"]]`, found `(error: Literal["original error"]) -> Result[Any, Literal["new error from original error"]]`

PyWinCtl (https://github.com/Kalmat/PyWinCtl)
- src/pywinctl/_main.py:831:49 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:832:60 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:833:56 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:835:56 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:836:67 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:837:63 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:838:57 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:839:66 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:840:71 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:841:98 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

attrs (https://github.com/python-attrs/attrs)
- tests/test_cmp.py:364:23 error[invalid-argument-type] Argument to function `cmp_using` is incorrect: Expected `((Any, Any, /) -> bool) | None`, found `(a: Any, b: Any) -> _NotImplementedType | (bool & Unknown)`
+ tests/test_cmp.py:364:23 error[invalid-argument-type] Argument to function `cmp_using` is incorrect: Expected `((Any, Any, /) -> bool) | None`, found `(a: Any, b: Any) -> _NotImplementedType | (bool & Any)`

cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/owners.py:319:16 error[invalid-return-type] Return type does not match returned value: expected `None`, found `str`

core (https://github.com/home-assistant/core)
+ homeassistant/bootstrap.py:631:9 error[invalid-argument-type] Argument to bound method `exception` is incorrect: Expected `None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException`, found `tuple[type[BaseException], BaseException | None, TracebackType | None]`
+ homeassistant/components/fronius/sensor.py:611:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:611:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:620:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/fronius/sensor.py:637:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:637:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:646:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/fronius/sensor.py:663:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:663:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:673:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/gardena_bluetooth/sensor.py:62:48 error[invalid-assignment] Object of type `(x: T@GardenaBluetoothSensorEntityDescription | None) -> T@GardenaBluetoothSensorEntityDescription | None` is not assignable to `(T@GardenaBluetoothSensorEntityDescription | None, /) -> SensorRawType`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/settings/symbol_db.py:25:83 error[unresolved-attribute] Object of type `Env` has no attribute `includes`
+ tests/debugging/exploration/_config.py:81:19 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/debugging/exploration/_config.py:81:46 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/debugging/exploration/_config.py:87:28 error[unresolved-attribute] Object of type `Env` has no attribute `conservative`
+ tests/debugging/exploration/_config.py:89:26 error[unresolved-attribute] Object of type `Env` has no attribute `conservative`
+ tests/internal/bytecode_injection/framework_injection/_config.py:59:19 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/internal/bytecode_injection/framework_injection/_config.py:59:46 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ ddtrace/internal/settings/dynamic_instrumentation.py:123:97 error[unresolved-attribute] Object of type `Env` has no attribute `redacted_types`
+ ddtrace/internal/settings/dynamic_instrumentation.py:124:12 error[unresolved-attribute] Object of type `Env` has no attribute `redacted_types`

egglog-python (https://github.com/egraphs-good/egglog-python)
- python/egglog/exp/array_api.py:2031:71 error[invalid-argument-type] Argument to bound method `if_` is incorrect: Expected `() -> NDArray`, found `() -> Value | Unknown | Int`
+ python/egglog/exp/array_api.py:2031:71 error[invalid-argument-type] Argument to bound method `if_` is incorrect: Expected `() -> NDArray`, found `() -> Value | Int | i64 | ... omitted 5 union elements`
+ python/egglog/exp/array_api.py:2031:79 error[invalid-argument-type] Method `__getitem__` of type `bound method Vec[Int].__getitem__(index: i64 | int) -> Int` cannot be called with key of type `Int` on object of type `Vec[Int]`
+ python/egglog/exp/array_api.py:2031:79 error[invalid-argument-type] Method `__getitem__` of type `bound method Vec[Value].__getitem__(index: i64 | int) -> Value` cannot be called with key of type `Int` on object of type `Vec[Value]`

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:1735:52 error[invalid-assignment] Object of type `((x: str | None) -> object) | (((str | None, /) -> str | None) & ~Top[Mapping[Unknown, object]])` is not assignable to `(str | None, /) -> str | None`
- src/hydra_zen/wrapper/_implementations.py:1736:59 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

ignite (https://github.com/pytorch/ignite)
+ tests/ignite/handlers/test_checkpoint.py:272:92 error[unresolved-attribute] Attribute `score` is not defined on `State` in union `Unknown | State`
+ tests/ignite/handlers/test_checkpoint.py:348:89 error[unresolved-attribute] Attribute `score` is not defined on `State` in union `Unknown | State`

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/backend/ninjabackend.py:1942:81 error[unresolved-attribute] Attribute `startswith` is not defined on `None` in union `str | None`

mypy (https://github.com/python/mypy)
+ mypy/semanal.py:7195:50 error[invalid-argument-type] Argument to function `isinstance` is incorrect: Expected `type | UnionType | tuple[Divergent, ...]`, found `object`
+ mypy/semanal.py:7196:44 error[unresolved-attribute] Object of type `object` has no attribute `type`
+ mypy/semanal.py:7208:23 error[unresolved-attribute] Object of type `object` has no attribute `type`

optuna (https://github.com/optuna/optuna)
+ optuna/samplers/_tpe/_erf.py:117:72 error[invalid-assignment] Object of type `list[((ndarray[Unknown, dtype[Any]], /) -> ndarray[Unknown, dtype[Any]]) | ((x: ndarray[Unknown, dtype[Any]]) -> float64 | Any)]` is not assignable to `list[(ndarray[Unknown, dtype[Any]], /) -> ndarray[Unknown, dtype[Any]]]`
+ tests/visualization_tests/test_contour.py:523:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_edf.py:172:33 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_parallel_coordinate.py:780:33 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_param_importances.py:273:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_param_importances.py:295:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:333:13 error[invalid-argument-type] Argument to function `_get_pareto_front_info` is incorrect: Expected `((FrozenTrial, /) -> Sequence[int | float]) | None`, found `(t: FrozenTrial) -> Unknown | int | float`
+ tests/visualization_tests/test_pareto_front.py:333:31 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:32 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:45 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:58 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_rank.py:615:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_slice.py:402:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method

paasta (https://github.com/yelp/paasta)
- paasta_tools/setup_prometheus_adapter_config.py:983:12 error[invalid-return-type] Return type does not match returned value: expected `PrometheusAdapterConfig`, found `dict[str, list[PrometheusAdapterRule | UnspecializedTypeVar]]`

pandas (https://github.com/pandas-dev/pandas)
+ pandas/tests/extension/base/methods.py:397:48 error[unsupported-operator] Operator `<=` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:410:49 error[unsupported-operator] Operator `<=` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:446:47 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:450:48 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:454:49 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:12:46 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:16:51 error[invalid-argument-type] Argument to function `min` is incorrect: Argument type `Hashable` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ pandas/tests/series/methods/test_combine.py:16:54 error[invalid-argument-type] Argument to function `min` is incorrect: Argument type `Hashable` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ pandas/tests/series/methods/test_combine.py:24:44 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:35:46 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/test_categorical.py:127:48 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/test_categorical.py:134:49 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
- pandas/tests/frame/methods/test_map.py:101:46 error[invalid-argument-type] Argument to bound method `map` is incorrect: Expected `(Any, /) -> Any`, found `(x: Any, y) -> Unknown`
+ pandas/tests/frame/methods/test_map.py:101:46 error[invalid-argument-type] Argument to bound method `map` is incorrect: Expected `(Any, /) -> Any`, found `(x: Any, y) -> Any`
- pandas/tseries/holiday.py:412:20 error[invalid-return-type] Return type does not match returned value: expected `DatetimeIndex`, found `Index`

pycryptodome (https://github.com/Legrandin/pycryptodome)
+ lib/Crypto/SelfTest/Protocol/test_KDF.py:141:52 error[invalid-argument-type] Argument to function `new` is incorrect: Expected `bytes | bytearray | memoryview[int]`, found `int`

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_mock_val_ser.py:137:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `validator` of type `SchemaValidator | PluggableSchemaValidator`
+ pydantic/_internal/_mock_val_ser.py:137:5 error[invalid-assignment] Object of type `MockValSer[SchemaValidator | PluggableSchemaValidator]` is not assignable to attribute `validator` of type `SchemaValidator | PluggableSchemaValidator`
- pydantic/_internal/_mock_val_ser.py:143:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `serializer` of type `SchemaSerializer`
+ pydantic/_internal/_mock_val_ser.py:143:5 error[invalid-assignment] Object of type `MockValSer[SchemaSerializer]` is not assignable to attribute `serializer` of type `SchemaSerializer`
- pydantic/_internal/_mock_val_ser.py:176:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `__pydantic_validator__` of type `SchemaValidator | PluggableSchemaValidator`
+ pydantic/_internal/_mock_val_ser.py:176:5 error[invalid-assignment] Object of type `MockValSer[SchemaValidator | PluggableSchemaValidator]` is not assignable to attribute `__pydantic_validator__` of type `SchemaValidator | PluggableSchemaValidator`
- pydantic/_internal/_mock_val_ser.py:182:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `__pydantic_serializer__` of type `SchemaSerializer`
+ pydantic/_internal/_mock_val_ser.py:182:5 error[invalid-assignment] Object of type `MockValSer[SchemaSerializer]` is not assignable to attribute `__pydantic_serializer__` of type `SchemaSerializer`
+ pydantic/main.py:110:81 error[invalid-assignment] Object of type `dict[str, ((model: BaseModel, name: str, val: Any) -> None) | ((model: BaseModel, name: str, val: Any) -> dict[str, Any] | tuple[dict[str, Any], dict[str, Any] | None, set[str]] | Any)]` is not assignable to `Mapping[str, (BaseModel, str, Any, /) -> None]`

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/chain/evm/node_inquirer.py:1393:21 error[invalid-argument-type] Argument to bound method `get_l1_fee` is incorrect: Expected `Literal[ChainID.OPTIMISM, ChainID.BASE, ChainID.SCROLL]`, found `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`

schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/dlang_codegen.py:440:50 error[unsupported-operator] Operator `&` is not supported between two objects of type `Sized`

static-frame (https://github.com/static-frame/static-frame)
- static_frame/test/unit/test_series.py:2681:65 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/test/unit/test_store_zip.py:176:61 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/test/unit/test_yarn.py:1676:53 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1691:41 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1696:37 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1712:53 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `@Todo | tuple[Any, Any]`

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/watcher/local_sources_watcher.py:242:72 error[invalid-assignment] Object of type `list[((ModuleType, /) -> list[str | None]) | ((m: ModuleType) -> list[Never] | list[str | None])]` is not assignable to `list[(ModuleType, /) -> list[str | None]]`
+ lib/streamlit/watcher/local_sources_watcher.py:267:18 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[str | None]`, found `object`

sympy (https://github.com/sympy/sympy)
+ sympy/core/basic.py:787:33 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/matrices/matrixbase.py:2644:72 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/matrices/matrixbase.py:2736:71 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ sympy/plotting/plot.py:104:28 error[not-subscriptable] Cannot subscript object of type `Basic` with no `__getitem__` method
+ sympy/plotting/plot.py:104:52 error[not-subscriptable] Cannot subscript object of type `Basic` with no `__getitem__` method
+ sympy/tensor/array/array_derivatives.py:52:52 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

vision (https://github.com/pytorch/vision)
+ test/builtin_dataset_mocks.py:644:21 error[invalid-argument-type] Argument to function `create_image_folder` is incorrect: Expected `(int, /) -> str`, found `(idx: int) -> str | int | Unknown`
+ test/builtin_dataset_mocks.py:646:21 error[invalid-argument-type] Argument to function `create_image_folder` is incorrect: Expected `Sequence[int] | int | ((int, /) -> Sequence[int] | int) | None`, found `(idx: int) -> tuple[Literal[3], str | int | Unknown, str | int | Unknown]`

Full report with detailed diff (timing results)

@ibraheemdev ibraheemdev force-pushed the ibraheem/callable-tcx branch 2 times, most recently from 2583e1a to 7eda4ee Compare March 30, 2026 21:14
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 30, 2026

Merging this PR will degrade performance by 5.31%

❌ 1 regressed benchmark
✅ 46 untouched benchmarks
⏩ 60 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime pydantic 7.6 s 8 s -5.31%

Comparing ibraheem/callable-tcx (3b5d296) with main (d1a23cd)

Open in CodSpeed

Footnotes

  1. 60 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.

@ibraheemdev ibraheemdev force-pushed the ibraheem/callable-tcx branch 2 times, most recently from 0026c70 to 8804a2c Compare April 1, 2026 23:48
@ibraheemdev ibraheemdev force-pushed the ibraheem/callable-tcx branch 4 times, most recently from ffee1da to dd15d65 Compare April 8, 2026 05:20
@ibraheemdev ibraheemdev force-pushed the ibraheem/callable-tcx branch from dd15d65 to 37b6769 Compare April 8, 2026 20:57
@ibraheemdev ibraheemdev force-pushed the ibraheem/callable-tcx branch from 37b6769 to 3b5d296 Compare April 8, 2026 21:01
@ibraheemdev ibraheemdev marked this pull request as ready for review April 8, 2026 21:02
@ibraheemdev
Copy link
Copy Markdown
Member Author

ibraheemdev commented Apr 8, 2026

I haven't looked too closely at the ecosystem report but those diagnostics look expected, as this PR increases our type inference coverage quite significantly where we would previously infer Unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants