Skip to content

[ty] Propagate type context through comprehensions#22564

Merged
ibraheemdev merged 4 commits intomainfrom
ibraheem/comprehension-tcx
Jan 20, 2026
Merged

[ty] Propagate type context through comprehensions#22564
ibraheemdev merged 4 commits intomainfrom
ibraheem/comprehension-tcx

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Jan 14, 2026

Summary

Resolves astral-sh/ty#1602.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Jan 14, 2026

```py
# TODO: This should reveal `Literal["a", "b"]`
# revealed: Unknown | str
Copy link
Member Author

@ibraheemdev ibraheemdev Jan 14, 2026

Choose a reason for hiding this comment

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

This and the other todos are astral-sh/ty#2486 (and some will also be fixed indirectly by astral-sh/ty#1240).

tcx: TypeContext<'db>,
}

impl<'db> InferScope<'db> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally we could have a generic InferRegion type, but the salsa macros don't seem to like it.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 14, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 14, 2026

mypy_primer results

Changes were detected when running on open source projects
attrs (https://github.com/python-attrs/attrs)
- src/attr/_make.py:2644:33: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Attribute | Unknown`
+ src/attr/_make.py:2644:33: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Unknown | Attribute`
- src/attr/_make.py:2646:29: warning[possibly-missing-attribute] Attribute `hash` may be missing on object of type `Attribute | Unknown`
+ src/attr/_make.py:2646:29: warning[possibly-missing-attribute] Attribute `hash` may be missing on object of type `Unknown | Attribute`
- src/attr/_make.py:2646:40: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Attribute | Unknown`
+ src/attr/_make.py:2646:40: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Unknown | Attribute`

aioredis (https://github.com/aio-libs/aioredis)
- aioredis/connection.py:441:16: error[invalid-return-type] Return type does not match returned value: expected `bytes | memoryview[int] | str | ... omitted 4 union elements`, found `(@Todo & ~bytes) | int | list[bytes | memoryview[int] | str | ... omitted 5 union elements] | ... omitted 4 union elements`
+ aioredis/connection.py:441:16: error[invalid-return-type] Return type does not match returned value: expected `bytes | memoryview[int] | str | ... omitted 4 union elements`, found `(@Todo & ~bytes) | int | list[Unknown | bytes | memoryview[int] | ... omitted 5 union elements] | ... omitted 4 union elements`

pip (https://github.com/pypa/pip)
- src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
+ src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
- src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
+ src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
- src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Sized | Unknown` and `LiteralString`
+ src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | Sized` and `LiteralString`

spack (https://github.com/spack/spack)
- lib/spack/spack/detection/path.py:399:20: error[invalid-assignment] Object of type `list[Pattern[str] | Unknown]` is not assignable to `list[str]`
+ lib/spack/spack/detection/path.py:399:20: error[invalid-assignment] Object of type `list[str | Pattern[str]]` is not assignable to `list[str]`
- lib/spack/spack/directives.py:367:15: error[invalid-assignment] Object of type `list[Unknown | ~str]` is not assignable to `((type[PackageBase] | Dependency, /) -> None) | str | list[((type[PackageBase] | Dependency, /) -> None) | str] | None`
+ lib/spack/spack/directives.py:367:15: error[invalid-assignment] Object of type `list[object]` is not assignable to `((type[PackageBase] | Dependency, /) -> None) | str | list[((type[PackageBase] | Dependency, /) -> None) | str] | None`
- lib/spack/spack/environment/environment.py:1652:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[list[Spec], list[Spec], list[tuple[Spec, Spec]]]`, found `tuple[list[Unknown] & ~AlwaysFalsy, list[Unknown], list[tuple[Unknown, None] | Unknown]]`
+ lib/spack/spack/environment/environment.py:1652:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[list[Spec], list[Spec], list[tuple[Spec, Spec]]]`, found `tuple[list[Unknown] & ~AlwaysFalsy, list[Unknown], list[Unknown | tuple[Unknown, None]]]`
- lib/spack/spack/fetch_strategy.py:1500:42: error[invalid-argument-type] Argument to function `quote` is incorrect: Expected `list[str]`, found `set[@Todo]`
+ lib/spack/spack/fetch_strategy.py:1500:42: error[invalid-argument-type] Argument to function `quote` is incorrect: Expected `list[str]`, found `set[Unknown]`
- lib/spack/spack/test/cmd/ci.py:2026:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion | Unknown]`
+ lib/spack/spack/test/cmd/ci.py:2026:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2041:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion | Unknown]`
+ lib/spack/spack/test/cmd/ci.py:2041:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2065:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion | Unknown]`
+ lib/spack/spack/test/cmd/ci.py:2065:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2089:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion | Unknown]`
+ lib/spack/spack/test/cmd/ci.py:2089:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2117:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion | Unknown]`
+ lib/spack/spack/test/cmd/ci.py:2117:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
- lib/spack/spack/test/spec_semantics.py:2106:19: error[invalid-argument-type] Argument to function `sorted` is incorrect: Argument type `Spec | Unknown` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ lib/spack/spack/test/spec_semantics.py:2106:19: error[invalid-argument-type] Argument to function `sorted` is incorrect: Argument type `Unknown | Spec` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
- lib/spack/spack/test/spec_semantics.py:2111:16: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Spec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:2111:16: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Unknown | Spec`
- lib/spack/spack/test/spec_semantics.py:2112:17: error[unsupported-operator] Operator `<` is not supported between two objects of type `Spec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:2112:17: error[unsupported-operator] Operator `<` is not supported between two objects of type `Unknown | Spec`
- lib/spack/spack/test/spec_semantics.py:2113:16: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Spec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:2113:16: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Unknown | Spec`
- lib/spack/spack/test/spec_semantics.py:2114:17: error[unsupported-operator] Operator `>` is not supported between two objects of type `Spec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:2114:17: error[unsupported-operator] Operator `>` is not supported between two objects of type `Unknown | Spec`
- lib/spack/spack/vendor/attr/_make.py:2653:33: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Attribute | Unknown`
+ lib/spack/spack/vendor/attr/_make.py:2653:33: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Unknown | Attribute`
- lib/spack/spack/vendor/attr/_make.py:2655:29: warning[possibly-missing-attribute] Attribute `hash` may be missing on object of type `Attribute | Unknown`
+ lib/spack/spack/vendor/attr/_make.py:2655:29: warning[possibly-missing-attribute] Attribute `hash` may be missing on object of type `Unknown | Attribute`
- lib/spack/spack/vendor/attr/_make.py:2655:40: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Attribute | Unknown`
+ lib/spack/spack/vendor/attr/_make.py:2655:40: warning[possibly-missing-attribute] Attribute `name` may be missing on object of type `Unknown | Attribute`
- lib/spack/spack/vendor/jinja2/environment.py:1494:20: error[invalid-return-type] Return type does not match returned value: expected `list[tuple[int, int]]`, found `list[tuple[int, ...] | Unknown]`
+ lib/spack/spack/vendor/jinja2/environment.py:1494:20: error[invalid-return-type] Return type does not match returned value: expected `list[tuple[int, int]]`, found `list[tuple[int, ...]]`
- lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[bytes | Unknown | str | PathLike[str] | PathLike[bytes]]`
+ lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[Unknown | bytes | str | PathLike[str] | PathLike[bytes]]`

werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/debug/tbtools.py:266:16: error[invalid-return-type] Return type does not match returned value: expected `list[DebugFrameSummary]`, found `list[FrameSummary | Unknown]`
+ src/werkzeug/debug/tbtools.py:266:16: error[invalid-return-type] Return type does not match returned value: expected `list[DebugFrameSummary]`, found `list[FrameSummary]`
- tests/test_routing.py:601:5: warning[possibly-missing-attribute] Attribute `add` may be missing on object of type `Unknown | None | set[str | Unknown]`
+ tests/test_routing.py:601:5: warning[possibly-missing-attribute] Attribute `add` may be missing on object of type `Unknown | None | set[str]`
- tests/test_routing.py:603:5: warning[possibly-missing-attribute] Attribute `discard` may be missing on object of type `Unknown | None | set[str | Unknown]`
+ tests/test_routing.py:603:5: warning[possibly-missing-attribute] Attribute `discard` may be missing on object of type `Unknown | None | set[str]`

jinja (https://github.com/pallets/jinja)
- src/jinja2/environment.py:1496:20: error[invalid-return-type] Return type does not match returned value: expected `list[tuple[int, int]]`, found `list[tuple[int, ...] | Unknown]`
+ src/jinja2/environment.py:1496:20: error[invalid-return-type] Return type does not match returned value: expected `list[tuple[int, int]]`, found `list[tuple[int, ...]]`

graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/utilities/find_breaking_changes.py:107:12: error[invalid-return-type] Return type does not match returned value: expected `list[BreakingChange]`, found `list[BreakingChange | DangerousChange | Unknown]`
+ src/graphql/utilities/find_breaking_changes.py:107:12: error[invalid-return-type] Return type does not match returned value: expected `list[BreakingChange]`, found `list[BreakingChange | DangerousChange]`
- src/graphql/utilities/find_breaking_changes.py:122:12: error[invalid-return-type] Return type does not match returned value: expected `list[DangerousChange]`, found `list[BreakingChange | DangerousChange | Unknown]`
+ src/graphql/utilities/find_breaking_changes.py:122:12: error[invalid-return-type] Return type does not match returned value: expected `list[DangerousChange]`, found `list[DangerousChange | BreakingChange]`

scrapy (https://github.com/scrapy/scrapy)
- scrapy/utils/python.py:266:16: error[invalid-return-type] Return type does not match returned value: expected `Iterable[_KT@without_none_values]`, found `dict[object, ~None | Unknown]`
+ scrapy/utils/python.py:266:16: error[invalid-return-type] Return type does not match returned value: expected `Iterable[_KT@without_none_values]`, found `dict[object, Unknown | ~None]`

paasta (https://github.com/yelp/paasta)
- paasta_tools/instance/kubernetes.py:1146:12: error[invalid-return-type] Return type does not match returned value: expected `KubernetesVersionDict`, found `dict[Unknown | str, Unknown | str | int | list[Mapping[str, Any] | Unknown] | None]`
+ paasta_tools/instance/kubernetes.py:1146:12: error[invalid-return-type] Return type does not match returned value: expected `KubernetesVersionDict`, found `dict[Unknown | str, Unknown | str | int | list[Unknown | Mapping[str, Any]] | None]`

kopf (https://github.com/nolar/kopf)
- kopf/_core/engines/admission.py:449:42: error[invalid-assignment] Object of type `list[dict[Unknown | str, Unknown | str] | dict[Unknown | str, Unknown | str | list[Unknown | str]] | Unknown]` is not assignable to `Collection[MatchExpression]`
- Found 260 diagnostics
+ Found 259 diagnostics

pytest (https://github.com/pytest-dev/pytest)
+ testing/test_config.py:2516:21: warning[possibly-missing-attribute] Submodule `config` may not be available as an attribute on module `_pytest`
- Found 413 diagnostics
+ Found 414 diagnostics

dulwich (https://github.com/dulwich/dulwich)
- dulwich/refs.py:1992:12: error[invalid-return-type] Return type does not match returned value: expected `T@filter_ref_prefix`, found `dict[Ref | Unknown, ObjectID | None | Unknown]`
+ dulwich/refs.py:1992:12: error[invalid-return-type] Return type does not match returned value: expected `T@filter_ref_prefix`, found `dict[Unknown | Ref, Unknown | ObjectID | None]`

sockeye (https://github.com/awslabs/sockeye)
- sockeye/data_io.py:506:28: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> int | Unknown, (s: slice[Any, Any, Any], /) -> list[int | Unknown]]` cannot be called with key of type `None` on object of type `list[int | Unknown]`
+ sockeye/data_io.py:506:28: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown | int, (s: slice[Any, Any, Any], /) -> list[Unknown | int]]` cannot be called with key of type `None` on object of type `list[Unknown | int]`
- sockeye/data_io.py:522:13: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> int | Unknown, (s: slice[Any, Any, Any], /) -> list[int | Unknown]]` cannot be called with key of type `None` on object of type `list[int | Unknown]`
+ sockeye/data_io.py:522:13: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown | int, (s: slice[Any, Any, Any], /) -> list[Unknown | int]]` cannot be called with key of type `None` on object of type `list[Unknown | int]`
- sockeye/inference.py:350:50: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(Unknown & ~Top[list[Unknown]]) | None | list[list[str] | Unknown]`
+ sockeye/inference.py:350:50: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(Unknown & ~Top[list[Unknown]]) | None | list[Unknown | list[str]]`
- sockeye/inference.py:352:34: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(Unknown & ~Top[list[Unknown]]) | None | list[list[str] | Unknown]`
+ sockeye/inference.py:352:34: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(Unknown & ~Top[list[Unknown]]) | None | list[Unknown | list[str]]`
- sockeye/test_utils.py:105:101: error[not-iterable] Object of type `None | list[list[str | Unknown] | Unknown]` may not be iterable
+ sockeye/test_utils.py:105:101: error[not-iterable] Object of type `None | list[Unknown | list[Unknown | str]]` may not be iterable

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- test/mitmproxy/addons/test_proxyserver.py:119:36: error[invalid-argument-type] Argument to function `wait_for` is incorrect: Expected `Awaitable[Unknown]`, found `Task[Unknown] | None | Unknown`
+ test/mitmproxy/addons/test_proxyserver.py:119:36: error[invalid-argument-type] Argument to function `wait_for` is incorrect: Expected `Awaitable[Unknown]`, found `Unknown | Task[Unknown] | None`

optuna (https://github.com/optuna/optuna)
- optuna/storages/_rdb/storage.py:367:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Any]`
+ optuna/storages/_rdb/storage.py:367:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Unknown]`
- optuna/storages/_rdb/storage.py:376:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Any]`
+ optuna/storages/_rdb/storage.py:376:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Unknown]`
- optuna/storages/_rdb/storage.py:386:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Any]`
+ optuna/storages/_rdb/storage.py:386:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Unknown]`
- optuna/storages/_rdb/storage.py:396:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Any]`
+ optuna/storages/_rdb/storage.py:396:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | Column[Unknown], Unknown]`

schema_salad (https://github.com/common-workflow-language/schema_salad)
- schema_salad/schema.py:572:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["symbols"]` and value of type `list[str | Unknown]` on object of type `MutableSequence[Any]`
+ schema_salad/schema.py:572:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["symbols"]` and value of type `list[Unknown | str]` on object of type `MutableSequence[Any]`

psycopg (https://github.com/psycopg/psycopg)
- tests/test_conninfo_attempts.py:182:5: error[invalid-argument-type] Argument to bound method `sort` is incorrect: Argument type `str | int | None | Unknown` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ tests/test_conninfo_attempts.py:182:5: error[invalid-argument-type] Argument to bound method `sort` is incorrect: Argument type `Unknown | str | int | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
- tests/test_conninfo_attempts_async.py:189:5: error[invalid-argument-type] Argument to bound method `sort` is incorrect: Argument type `str | int | None | Unknown` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ tests/test_conninfo_attempts_async.py:189:5: error[invalid-argument-type] Argument to bound method `sort` is incorrect: Argument type `Unknown | str | int | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`

vision (https://github.com/pytorch/vision)
- torchvision/utils.py:763:14: error[invalid-assignment] Object of type `list[tuple[int, int, int] | tuple[int, int, int, int] | Unknown]` is not assignable to `None | str | tuple[int, int, int] | list[str | tuple[int, int, int]]`
+ torchvision/utils.py:763:14: error[invalid-assignment] Object of type `list[str | tuple[int, int, int] | tuple[int, int, int, int] | (Unknown & ~str)]` is not assignable to `None | str | tuple[int, int, int] | list[str | tuple[int, int, int]]`

artigraph (https://github.com/artigraph/artigraph)
- src/arti/storage/__init__.py:221:13: error[invalid-argument-type] Argument is incorrect: Expected `tuple[str, ...]`, found `str | Any`
+ src/arti/storage/__init__.py:221:13: error[invalid-argument-type] Argument is incorrect: Expected `tuple[str, ...]`, found `Unknown | str`

discord.py (https://github.com/Rapptz/discord.py)
- discord/components.py:1326:27: error[invalid-argument-type] Invalid argument to key "components" with declared type `list[ActionRow | TextComponent | MediaGalleryComponent | ... omitted 5 union elements]` on TypedDict `ContainerComponent`: value of type `list[ButtonComponent | SelectMenu | TextInput | ... omitted 11 union elements]`
+ discord/components.py:1326:27: error[invalid-argument-type] Invalid argument to key "components" with declared type `list[ActionRow | TextComponent | MediaGalleryComponent | ... omitted 5 union elements]` on TypedDict `ContainerComponent`: value of type `list[ActionRow | TextComponent | MediaGalleryComponent | ... omitted 10 union elements]`
- discord/role.py:450:45: error[invalid-assignment] Object of type `list[dict[Unknown | str, Unknown] | Unknown]` is not assignable to `list[RolePositionUpdate]`
- discord/role.py:700:45: error[invalid-assignment] Object of type `list[dict[Unknown | str, Unknown | int] | Unknown]` is not assignable to `list[RolePositionUpdate]`
- Found 542 diagnostics
+ Found 540 diagnostics

pandera (https://github.com/pandera-dev/pandera)
- pandera/api/pandas/components.py:400:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown | None | str, Unknown | Index]`
+ pandera/api/pandas/components.py:400:16: error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[str | Unknown | None, Any]`
- pandera/api/pandas/model.py:210:13: error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `type | Literal["bool", "boolean", "?", "b1", "bool_", ... omitted 154 literals] | ExtensionDtype | ... omitted 3 union elements`, found `dict[str | Unknown, Any | None]`
+ pandera/api/pandas/model.py:210:13: error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `type | Literal["bool", "boolean", "?", "b1", "bool_", ... omitted 154 literals] | ExtensionDtype | ... omitted 3 union elements`, found `dict[Unknown | str, Unknown | None]`
- tests/pandas/test_pydantic.py:308:53: error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `type | Literal["bool", "boolean", "?", "b1", "bool_", ... omitted 154 literals] | ExtensionDtype | ... omitted 3 union elements`, found `dict[Unknown, Unknown] | dict[str | Unknown, Any | None | type[Any]]`
+ tests/pandas/test_pydantic.py:308:53: error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `type | Literal["bool", "boolean", "?", "b1", "bool_", ... omitted 154 literals] | ExtensionDtype | ... omitted 3 union elements`, found `dict[Unknown, Unknown] | dict[Unknown | str, Unknown | None | type[Any]]`

freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/data/btanalysis/bt_fileutils.py:238:12: error[invalid-return-type] Return type does not match returned value: expected `list[BacktestHistoryEntryType]`, found `list[dict[Unknown | str, Unknown | str] | Unknown]`
- freqtrade/exchange/exchange_utils.py:132:48: error[invalid-assignment] Object of type `list[dict[Unknown | str, Unknown] | Unknown]` is not assignable to `list[TradeModeType]`
- freqtrade/plugins/pairlist/PercentChangePairList.py:218:56: error[invalid-assignment] Object of type `list[dict[Unknown | str, Unknown | str | None] | Unknown]` is not assignable to `list[SymbolWithPercentage]`
- Found 648 diagnostics
+ Found 645 diagnostics

apprise (https://github.com/caronc/apprise)
- apprise/persistent_store.py:1538:35: error[invalid-argument-type] Argument to function `unlink` is incorrect: Expected `str | bytes | PathLike[str] | PathLike[bytes]`, found `int | str | bytes | ... omitted 3 union elements`
+ apprise/persistent_store.py:1538:35: error[invalid-argument-type] Argument to function `unlink` is incorrect: Expected `str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | int | str | ... omitted 3 union elements`
- apprise/plugins/email/base.py:1048:28: error[invalid-assignment] Object of type `list[str | Unknown]` is not assignable to `set[Unknown] | None`
+ apprise/plugins/email/base.py:1048:28: error[invalid-assignment] Object of type `list[Unknown | str]` is not assignable to `set[Unknown] | None`

xarray (https://github.com/pydata/xarray)
- properties/test_properties.py:59:39: error[invalid-argument-type] Argument to function `find_independent_seasons` is incorrect: Expected `Sequence[str]`, found `list[list[Unknown] | Unknown]`
+ properties/test_properties.py:59:39: error[invalid-argument-type] Argument to function `find_independent_seasons` is incorrect: Expected `Sequence[str]`, found `list[Unknown | list[Unknown]]`
+ xarray/core/dataarray.py:164:21: error[invalid-assignment] Invalid subscript assignment with key of type `int` and value of type `Hashable` on object of type `list[str]`
- xarray/core/dataarray.py:473:9: error[invalid-assignment] Object of type `(Sequence[Sequence[Unknown] | Index[Any] | DataArray | Variable | ndarray[tuple[Any, ...], dtype[Any]]] & Top[dict[Unknown, Unknown]]) | (Mapping[Unknown, Unknown] & Top[dict[Unknown, Unknown]]) | dict[Hashable, Variable | Unknown]` is not assignable to attribute `_coords` of type `dict[Any, Variable]`
+ xarray/core/dataarray.py:473:9: error[invalid-assignment] Object of type `(Sequence[Sequence[Unknown] | Index[Any] | DataArray | Variable | ndarray[tuple[Any, ...], dtype[Any]]] & Top[dict[Unknown, Unknown]]) | (Mapping[Unknown, Unknown] & Top[dict[Unknown, Unknown]]) | dict[Hashable, Unknown | Variable]` is not assignable to attribute `_coords` of type `dict[Any, Variable]`
- xarray/core/dataset.py:9127:21: error[invalid-argument-type] Argument to bound method `pad` is incorrect: Expected `int | float | tuple[int | float, int | float] | Mapping[Any, int | float | tuple[int | float, int | float]] | None`, found `Any | dict[Any, Any] | int | ... omitted 4 union elements`
+ xarray/core/dataset.py:9127:21: error[invalid-argument-type] Argument to bound method `pad` is incorrect: Expected `int | float | tuple[int | float, int | float] | Mapping[Any, int | float | tuple[int | float, int | float]] | None`, found `Any | dict[Unknown, Unknown] | int | ... omitted 4 union elements`
- xarray/core/treenode.py:133:13: error[invalid-assignment] Object of type `dict[str | Unknown, Self@_detach | Unknown]` is not assignable to attribute `_children` of type `dict[str, <special-form 'typing.Self'>]`
+ xarray/core/treenode.py:133:13: error[invalid-assignment] Object of type `dict[str, <special-form 'typing.Self'> | Self@_detach]` is not assignable to attribute `_children` of type `dict[str, <special-form 'typing.Self'>]`
- Found 1752 diagnostics
+ Found 1753 diagnostics

meson (https://github.com/mesonbuild/meson)
- docs/refman/generatorjson.py:31:16: error[invalid-return-type] Return type does not match returned value: expected `list[Type]`, found `list[dict[Unknown | str, Unknown | str | list[Type] | list[Unknown]] | Unknown]`
- mesonbuild/dependencies/dub.py:471:16: error[invalid-return-type] Return type does not match returned value: expected `list[FindTargetEntry]`, found `list[dict[Unknown | str, Unknown | str] | Unknown]`
- mesonbuild/dependencies/pkgconfig.py:215:16: error[invalid-return-type] Return type does not match returned value: expected `ImmutableListProtocol[str]`, found `list[str | Unknown]`
+ mesonbuild/dependencies/pkgconfig.py:215:16: error[invalid-return-type] Return type does not match returned value: expected `ImmutableListProtocol[str]`, found `list[Unknown | str]`
- mesonbuild/interpreter/interpreter.py:3305:13: error[invalid-assignment] Object of type `dict[str | Unknown, Compiler | Unknown]` is not assignable to attribute `compilers` of type `OrderedDict[str, Compiler]`
+ mesonbuild/interpreter/interpreter.py:3305:13: error[invalid-assignment] Object of type `dict[str, Compiler]` is not assignable to attribute `compilers` of type `OrderedDict[str, Compiler]`
- mesonbuild/interpreter/interpreter.py:3496:18: error[invalid-assignment] Object of type `dict[str | Unknown, object]` is not assignable to `Executable | StaticLibrary | SharedLibrary | SharedModule | Jar`
+ mesonbuild/interpreter/interpreter.py:3496:18: error[invalid-assignment] Object of type `dict[Unknown | str, object]` is not assignable to `Executable | StaticLibrary | SharedLibrary | SharedModule | Jar`
- mesonbuild/interpreter/type_checking.py:252:37: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str, str | list[str]] | None`, found `dict[object, list[Any] | Unknown]`
+ mesonbuild/interpreter/type_checking.py:252:37: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str, str | list[str]] | None`, found `dict[object, str | list[str]]`
- mesonbuild/interpreterbase/helpers.py:39:20: error[invalid-return-type] Return type does not match returned value: expected `str | int | Sequence[Divergent] | ... omitted 5 union elements`, found `dict[object, str | int | Sequence[Divergent] | ... omitted 6 union elements]`
+ mesonbuild/interpreterbase/helpers.py:39:20: error[invalid-return-type] Return type does not match returned value: expected `str | int | Sequence[Divergent] | ... omitted 5 union elements`, found `dict[object, Unknown | str | int | ... omitted 6 union elements]`
- mesonbuild/interpreterbase/interpreterbase.py:602:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[list[InterpreterObject], dict[str, InterpreterObject]]`, found `tuple[list[InterpreterObject | None | Unknown], dict[str, InterpreterObject | None]]`
+ mesonbuild/interpreterbase/interpreterbase.py:602:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[list[InterpreterObject], dict[str, InterpreterObject]]`, found `tuple[list[Unknown | InterpreterObject | None], dict[str, InterpreterObject | None]]`
- test cases/common/22 object extraction/check-obj.py:19:35: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `None | set[Any]`
+ test cases/common/22 object extraction/check-obj.py:19:35: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `None | set[Unknown]`
- unittests/allplatformstests.py:3199:41: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | str | dict[str | Unknown, Any] | ... omitted 3 union elements`
+ unittests/allplatformstests.py:3199:41: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | str | dict[Unknown | str, Unknown] | ... omitted 3 union elements`
- Found 2156 diagnostics
+ Found 2154 diagnostics

openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/book_providers.py:829:9: error[invalid-argument-type] Argument to function `multisort_best` is incorrect: Expected `list[tuple[Literal["min", "max"], (tuple[Edition, AbstractBookProvider[Unknown] | None] | Unknown, /) -> int | float]]`, found `list[Unknown | tuple[str, (rec) -> Unknown]]`
+ openlibrary/book_providers.py:829:9: error[invalid-argument-type] Argument to function `multisort_best` is incorrect: Expected `list[tuple[Literal["min", "max"], (Unknown | tuple[Edition, AbstractBookProvider[Unknown] | None], /) -> int | float]]`, found `list[Unknown | tuple[str, (rec) -> Unknown]]`
- openlibrary/plugins/books/dynlinks.py:355:17: warning[possibly-missing-attribute] Attribute `insert` may be missing on object of type `Unknown | str | list[dict[Unknown | str, Unknown | str] | Unknown] | ... omitted 3 union elements`
+ openlibrary/plugins/books/dynlinks.py:355:17: warning[possibly-missing-attribute] Attribute `insert` may be missing on object of type `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`
- openlibrary/plugins/books/dynlinks.py:399:33: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[dict[Unknown | str, Unknown | str] | Unknown] | ... omitted 3 union elements`
+ openlibrary/plugins/books/dynlinks.py:399:33: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`
- openlibrary/plugins/books/dynlinks.py:400:37: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[dict[Unknown | str, Unknown | str] | Unknown] | ... omitted 3 union elements`
+ openlibrary/plugins/books/dynlinks.py:400:37: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`

cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/builder.py:678:24: error[invalid-return-type] Return type does not match returned value: expected `None | int | str | ... omitted 3 union elements`, found `dict[object, None | int | str | ... omitted 4 union elements]`
+ cwltool/builder.py:678:24: error[invalid-return-type] Return type does not match returned value: expected `None | int | str | ... omitted 3 union elements`, found `dict[object, Unknown | None | int | ... omitted 4 union elements]`
- tests/test_provenance.py:638:41: error[invalid-argument-type] Argument to function `_arcp2file` is incorrect: Expected `str`, found `Node | Unknown`
+ tests/test_provenance.py:638:41: error[invalid-argument-type] Argument to function `_arcp2file` is incorrect: Expected `str`, found `Unknown | Node`
- tests/test_provenance.py:639:43: error[invalid-argument-type] Argument to bound method `parse` is incorrect: Expected `str | None`, found `Node | Unknown`
+ tests/test_provenance.py:639:43: error[invalid-argument-type] Argument to bound method `parse` is incorrect: Expected `str | None`, found `Unknown | Node`

strawberry (https://github.com/strawberry-graphql/strawberry)
- strawberry/experimental/pydantic/error_type.py:106:70: error[invalid-assignment] Object of type `list[tuple[Any, @Todo | type[list[Unknown]], dataclasses.Field[None]] | Unknown]` is not assignable to `list[tuple[str, Any, Field[Unknown]]]`
+ strawberry/experimental/pydantic/error_type.py:106:70: error[invalid-assignment] Object of type `list[tuple[str, Any, Field[Unknown]] | tuple[Any, @Todo | type[list[Unknown]], dataclasses.Field[None | Field[Unknown]]]]` is not assignable to `list[tuple[str, Any, Field[Unknown]]]`
- strawberry/permission.py:163:35: error[not-iterable] Object of type `list[~AlwaysFalsy | Unknown]` is not iterable
+ strawberry/permission.py:163:35: error[not-iterable] Object of type `list[Unknown | ~AlwaysFalsy]` is not iterable

pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/commands/killthreads.py:58:26: error[not-iterable] Object of type `list[int] | None | list[int | Unknown]` may not be iterable
+ pwndbg/commands/killthreads.py:58:26: error[not-iterable] Object of type `list[int] | None | list[Unknown | int]` may not be iterable
- pwndbg/commands/killthreads.py:71:62: error[not-iterable] Object of type `list[int] | None | list[int | Unknown]` may not be iterable
+ pwndbg/commands/killthreads.py:71:62: error[not-iterable] Object of type `list[int] | None | list[Unknown | int]` may not be iterable
- pwndbg/dbg_mod/__init__.py:905:16: error[invalid-return-type] Return type does not match returned value: expected `list[str]`, found `list[Unknown | str | None]`
+ pwndbg/dbg_mod/__init__.py:905:16: error[invalid-return-type] Return type does not match returned value: expected `list[str]`, found `list[str | Unknown | None]`
- pwndbg/gdblib/shellcode.py:105:46: error[invalid-argument-type] Argument to function `read` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/gdblib/shellcode.py:105:46: error[invalid-argument-type] Argument to function `read` is incorrect: Expected `int`, found `Unknown | int | None`
- pwndbg/gdblib/shellcode.py:106:31: error[invalid-argument-type] Argument to function `write` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/gdblib/shellcode.py:106:31: error[invalid-argument-type] Argument to function `write` is incorrect: Expected `int`, found `Unknown | int | None`
- pwndbg/gdblib/shellcode.py:125:22: error[unsupported-operator] Operator `+` is not supported between objects of type `int | None | Unknown` and `int`
+ pwndbg/gdblib/shellcode.py:125:22: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | None` and `int`
- pwndbg/gdblib/shellcode.py:148:31: error[invalid-argument-type] Argument to function `write` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/gdblib/shellcode.py:148:31: error[invalid-argument-type] Argument to function `write` is incorrect: Expected `int`, found `Unknown | int | None`
- pwndbg/gdblib/shellcode.py:149:50: error[invalid-argument-type] Argument to bound method `write_reg` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/gdblib/shellcode.py:149:50: error[invalid-argument-type] Argument to bound method `write_reg` is incorrect: Expected `int`, found `Unknown | int | None`
- pwndbg/gdblib/shellcode.py:152:46: error[invalid-argument-type] Argument to bound method `write_reg` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/gdblib/shellcode.py:152:46: error[invalid-argument-type] Argument to bound method `write_reg` is incorrect: Expected `int`, found `Unknown | int | None`

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/build_ext.py:270:23: warning[possibly-missing-attribute] Attribute `split` may be missing on object of type `(Unknown & ~AlwaysFalsy) | (list[tuple[Unknown, str] | Unknown] & ~AlwaysFalsy)`
+ setuptools/_distutils/command/build_ext.py:270:23: warning[possibly-missing-attribute] Attribute `split` may be missing on object of type `(Unknown & ~AlwaysFalsy) | (list[Unknown | tuple[Unknown, str]] & ~AlwaysFalsy)`
- setuptools/_distutils/sysconfig.py:568:12: error[invalid-return-type] Return type does not match returned value: expected `list[str | int] | dict[str, str | int]`, found `list[Any | None] | dict[str, Any]`
+ setuptools/_distutils/sysconfig.py:568:12: error[invalid-return-type] Return type does not match returned value: expected `list[str | int] | dict[str, str | int]`, found `list[str | int | Any | None] | dict[str, Any]`
- setuptools/command/rotate.py:50:24: error[not-iterable] Object of type `Unknown | None | list[str | Unknown]` may not be iterable
+ setuptools/command/rotate.py:50:24: error[not-iterable] Object of type `Unknown | None | list[Unknown | str]` may not be iterable

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:1325:20: error[invalid-return-type] Return type does not match returned value: expected `_T@_sanitize_collection`, found `dict[int | None | float | ... omitted 13 union elements, int | None | float | ... omitted 13 union elements]`
+ src/hydra_zen/structured_configs/_implementations.py:1325:20: error[invalid-return-type] Return type does not match returned value: expected `_T@_sanitize_collection`, found `dict[Unknown | int | None | ... omitted 13 union elements, Unknown | int | None | ... omitted 13 union elements]`
- src/hydra_zen/structured_configs/_implementations.py:2879:60: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[str, type, Field[Any]]`, found `tuple[str | @Todo, ...]`
+ src/hydra_zen/structured_configs/_implementations.py:2879:60: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[str, type, Field[Any]]`, found `tuple[Unknown | str, ...]`

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_vendor/croniter/croniter.py:1080:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `list[LiteralString]` and `list[str | Unknown | int]`
+ src/prefect/_vendor/croniter/croniter.py:1080:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `list[LiteralString]` and `list[Unknown | str | int]`
- src/prefect/cli/flow_run.py:264:40: error[invalid-argument-type] Argument is incorrect: Expected `FlowFilterId | None`, found `dict[Unknown | str, Unknown | list[UUID | Unknown]]`
+ src/prefect/cli/flow_run.py:264:40: error[invalid-argument-type] Argument is incorrect: Expected `FlowFilterId | None`, found `dict[Unknown | str, Unknown | list[Unknown | UUID]]`
- src/prefect/cli/work_queue.py:403:60: error[invalid-argument-type] Argument is incorrect: Expected `list[UUID] | None`, found `list[UUID | None | Unknown]`
+ src/prefect/cli/work_queue.py:403:60: error[invalid-argument-type] Argument is incorrect: Expected `list[UUID] | None`, found `list[Unknown | UUID | None]`
- src/prefect/deployments/flow_runs.py:198:13: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[str | Unknown, set[TaskRunResult | FlowRunResult] | Unknown]`
+ src/prefect/deployments/flow_runs.py:198:13: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[Unknown | str, Unknown | set[TaskRunResult | FlowRunResult]]`
- src/prefect/deployments/flow_runs.py:395:17: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[str | Unknown, set[TaskRunResult | FlowRunResult] | Unknown]`
+ src/prefect/deployments/flow_runs.py:395:17: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[Unknown | str, Unknown | set[TaskRunResult | FlowRunResult]]`
- src/prefect/server/models/block_documents.py:427:47: error[invalid-argument-type] Argument is incorrect: Expected `BlockSchemaFilterId | None`, found `dict[str, list[UUID | Unknown]]`
+ src/prefect/server/models/block_documents.py:427:47: error[invalid-argument-type] Argument is incorrect: Expected `BlockSchemaFilterId | None`, found `dict[str, list[Unknown | UUID]]`
- src/prefect/task_engine.py:167:45: error[invalid-assignment] Object of type `dict[str | Unknown, set[TaskRunResult | FlowRunResult] | Unknown]` is not assignable to `dict[str, set[RunInput]]`
+ src/prefect/task_engine.py:167:45: error[invalid-assignment] Object of type `dict[str, set[RunInput] | set[TaskRunResult | FlowRunResult]]` is not assignable to `dict[str, set[RunInput]]`
- src/prefect/tasks.py:964:17: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[str | Unknown, set[TaskRunResult | FlowRunResult] | Unknown]`
+ src/prefect/tasks.py:964:17: error[invalid-argument-type] Argument to bound method `create_task_run` is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]] | None`, found `dict[Unknown | str, Unknown | set[TaskRunResult | FlowRunResult]]`
- src/prefect/tasks.py:1083:17: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]]`, found `(dict[str | Unknown, set[TaskRunResult | FlowRunResult] | Unknown] & ~AlwaysFalsy) | dict[Unknown, Unknown]`
+ src/prefect/tasks.py:1083:17: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, list[TaskRunResult | FlowRunResult | Parameter | Constant]]`, found `(dict[Unknown | str, Unknown | set[TaskRunResult | FlowRunResult]] & ~AlwaysFalsy) | dict[Unknown, Unknown]`
- src/prefect/tasks.py:1634:20: error[invalid-return-type] Return type does not match returned value: expected `list[State[R@Task]] | PrefectFutureList[R@Task]`, found `list[PrefectDistributedFuture[R@Task] | Unknown] | @Todo`
+ src/prefect/tasks.py:1634:20: error[invalid-return-type] Return type does not match returned value: expected `list[State[R@Task]] | PrefectFutureList[R@Task]`, found `list[Unknown | PrefectDistributedFuture[R@Task]] | @Todo`
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[T@resolve_block_document_references | dict[str, Any] | Unknown]`
+ src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | T@resolve_block_document_references | dict[str, Any]]`
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, T@resolve_variables | Unknown]`
+ src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown | T@resolve_variables]`
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[T@resolve_variables | Unknown]`
+ src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown | T@resolve_variables]`

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/Cipher/_mode_kw.py:25:12: error[invalid-return-type] Return type does not match returned value: expected `bytes`, found `bytes | bytearray | Unknown`
+ lib/Crypto/Cipher/_mode_kw.py:25:12: error[invalid-return-type] Return type does not match returned value: expected `bytes`, found `Unknown | bytes | bytearray`
- lib/Crypto/Cipher/_mode_kw.py:39:36: error[invalid-argument-type] Argument to function `strxor` is incorrect: Expected `bytes`, found `bytes | bytearray | Unknown`
+ lib/Crypto/Cipher/_mode_kw.py:39:36: error[invalid-argument-type] Argument to function `strxor` is incorrect: Expected `bytes`, found `Unknown | bytes | bytearray`
- lib/Crypto/Cipher/_mode_kw.py:43:12: error[invalid-return-type] Return type does not match returned value: expected `bytes`, found `bytes | bytearray | Unknown`
+ lib/Crypto/Cipher/_mode_kw.py:43:12: error[invalid-return-type] Return type does not match returned value: expected `bytes`, found `Unknown | bytes | bytearray`
- lib/Crypto/IO/_PBES.py:531:26: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `int`, found `None | Unknown`
+ lib/Crypto/IO/_PBES.py:531:26: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `int`, found `Unknown | None`
- lib/Crypto/IO/_PBES.py:531:36: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `int`, found `None | Unknown`
+ lib/Crypto/IO/_PBES.py:531:36: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `int`, found `Unknown | None`
- lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py:275:37: error[invalid-argument-type] Argument to function `construct` is incorrect: Expected `tuple[int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase]`, found `list[int | Unknown]`
+ lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py:275:37: error[invalid-argument-type] Argument to function `construct` is incorrect: Expected `tuple[int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase]`, found `list[Unknown | int]`
- lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py:306:37: error[invalid-argument-type] Argument to function `construct` is incorrect: Expected `tuple[int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase, int | IntegerBase] | tuple[int | IntegerBase, int | IntegerBase, 

... (truncated 531 lines) ...
Memory usage changes were detected when running on open source projects
trio (https://github.com/python-trio/trio)
-     struct fields = ~12MB
+     struct fields = ~11MB

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 14, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 2 12 137
possibly-missing-attribute 3 1 71
invalid-return-type 0 25 37
invalid-assignment 1 20 35
unsupported-operator 0 0 32
not-iterable 0 0 9
type-assertion-failure 0 0 8
not-subscriptable 0 0 6
unused-ignore-comment 2 1 0
invalid-await 2 0 0
unresolved-attribute 0 0 2
Total 10 59 337

Full report with detailed diff (timing results)

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!

I'm guessing we may want similar treatment for generator expressions at some point, but those have enough of their own wrinkles that it makes sense to handle them separately.

Comment on lines 8929 to 8938
// Comprehensions are skipped when checking all scopes, so this is our only chance
// to report diagnostics.
if let Some(scope_diagnostics) = inference.diagnostics() {
self.context.extend(scope_diagnostics);
}

self.infer_comprehension_specialization(KnownClass::Dict, &[key_type, value_type], tcx)
self.infer_comprehension_specialization(KnownClass::Set, &[Some(elt)], inference, tcx)
.unwrap_or_else(|| {
KnownClass::Set.to_specialized_instance(self.db(), &[Type::unknown()])
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still a fair bit to duplicate for all comprehension kinds... seems like KnownClass::Set is the only set-distinct thing in here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's slightly better now with the extend_scope method, I'm not sure we can do much better here. The list and set cases are similar because they both have a single element type, while dictionaries have two.

@ibraheemdev ibraheemdev force-pushed the ibraheem/comprehension-tcx branch from fa2b058 to 109d2a5 Compare January 19, 2026 23:26
@ibraheemdev ibraheemdev requested a review from Gankra as a code owner January 19, 2026 23:53
@ibraheemdev ibraheemdev merged commit 6a2cc89 into main Jan 20, 2026
49 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/comprehension-tcx branch January 20, 2026 20:25
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.

Bidirectional inference with comprehensions

3 participants