Skip to content

[ty] Support calls to intersection types#22469

Merged
carljm merged 45 commits intomainfrom
claude/fix-issue-1858-UjARA
Feb 16, 2026
Merged

[ty] Support calls to intersection types#22469
carljm merged 45 commits intomainfrom
claude/fix-issue-1858-UjARA

Conversation

@carljm
Copy link
Contributor

@carljm carljm commented Jan 9, 2026

Fixes astral-sh/ty#1858

Handle calls to intersection types. Previously, calling an intersection type would return a @Todo type that suppressed errors but provided no useful type information.

Now, when calling an intersection type:

  • We check each positive element of the intersection for callability with given arguments
  • If at least one element can be called successfully with the given arguments, the intersection can be
  • The return type is the intersection of the return types from all successfully-called elements (plus any top-callable elements; these error when called because the arguments can't be correct for all members of the top-callable type -- but we know that some member of the top-callable type would match those arguments, so it's correct to still include the return type of the top-callable)
  • If no elements are callable, the "highest priority" errors from failed elements are reported
  • More specific errors are higher priority to report; for example if one intersection element is not callable at all, and the other is callable but the arguments were wrong, we report only the wrong arguments

Ecosystem review only revealed existing known issues or correct behaviors newly exposed by actually processing intersection calls and getting precise return types instead of Todo types

@carljm carljm added the ty Multi-file analysis & type inference label Jan 9, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 9, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 9, 2026

mypy_primer results

Changes were detected when running on open source projects
mypy_primer (https://github.com/hauntsaninja/mypy_primer)
+ mypy_primer/git_utils.py:65:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 3 diagnostics
+ Found 4 diagnostics

attrs (https://github.com/python-attrs/attrs)
- tests/test_make.py:2878:16: error[unsupported-operator] Operator `<` is not supported between two objects of type `C | @Todo`
+ tests/test_make.py:2878:16: error[unsupported-operator] Operator `<` is not supported between two objects of type `C | Any`
- tests/test_make.py:2883:16: error[unsupported-operator] Operator `>` is not supported between two objects of type `C | @Todo`
+ tests/test_make.py:2883:16: error[unsupported-operator] Operator `>` is not supported between two objects of type `C | Any`

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:206:20: error[call-non-callable] Object of type `Mapping[str, type[Exception]]` is not callable
- aioredis/connection.py:206:20: error[invalid-return-type] Return type does not match returned value: expected `ResponseError`, found `Exception | @Todo`
+ aioredis/connection.py:206:20: error[invalid-return-type] Return type does not match returned value: expected `ResponseError`, found `Exception | Unknown`
- Found 29 diagnostics
+ Found 30 diagnostics

pip (https://github.com/pypa/pip)
+ src/pip/_vendor/cachecontrol/controller.py:349:12: error[unresolved-attribute] Object of type `~None` has no attribute `status`
+ src/pip/_vendor/cachecontrol/controller.py:351:45: error[unresolved-attribute] Object of type `~None` has no attribute `status`
+ src/pip/_vendor/cachecontrol/controller.py:356:13: error[unresolved-attribute] Object of type `~None` has no attribute `headers`
+ src/pip/_vendor/cachecontrol/controller.py:420:49: error[invalid-argument-type] Argument to bound method `_cache_set` is incorrect: Expected `HTTPResponse`, found `~None`
+ src/pip/_vendor/cachecontrol/controller.py:424:18: error[unresolved-attribute] Object of type `~None` has no attribute `status`
+ src/pip/_vendor/cachecontrol/controller.py:426:49: error[invalid-argument-type] Argument to bound method `_cache_set` is incorrect: Expected `HTTPResponse`, found `~None`
+ src/pip/_vendor/cachecontrol/controller.py:443:21: error[invalid-argument-type] Argument to bound method `_cache_set` is incorrect: Expected `HTTPResponse`, found `~None`
+ src/pip/_vendor/cachecontrol/controller.py:466:25: error[invalid-argument-type] Argument to bound method `_cache_set` is incorrect: Expected `HTTPResponse`, found `~None`
+ src/pip/_vendor/rich/_log_render.py:60:36: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/pip/_vendor/rich/text.py:622:31: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/pip/_vendor/rich/text.py:622:31: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 619 diagnostics
+ Found 630 diagnostics

spack (https://github.com/spack/spack)
- lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[int | PathLike[str] | PathLike[bytes] | ... omitted 3 union elements]`
+ lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[int | str | bytes | ... omitted 3 union elements]`
+ lib/spack/spack/directives.py:392:13: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Sized | Unknown`
+ lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | Sized`
- lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized | Unknown`
+ lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/lock.py:735:24: error[call-non-callable] Object of type `ContextManager[Unknown]` is not callable
- lib/spack/spack/vendor/ruamel/yaml/main.py:1071:16: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1071:16: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `Unknown | Loader`
- lib/spack/spack/vendor/ruamel/yaml/main.py:1096:15: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1096:15: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `Unknown | Loader`
- lib/spack/spack/vendor/ruamel/yaml/main.py:1097:19: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1097:19: error[unresolved-attribute] Attribute `_constructor` is not defined on `Loader` in union `Unknown | Loader`
- lib/spack/spack/vendor/ruamel/yaml/main.py:1099:9: error[unresolved-attribute] Attribute `_parser` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1099:9: error[unresolved-attribute] Attribute `_parser` is not defined on `Loader` in union `Unknown | Loader`
- lib/spack/spack/vendor/ruamel/yaml/main.py:1101:13: error[unresolved-attribute] Attribute `_reader` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1101:13: error[unresolved-attribute] Attribute `_reader` is not defined on `Loader` in union `Unknown | Loader`
- lib/spack/spack/vendor/ruamel/yaml/main.py:1105:13: error[unresolved-attribute] Attribute `_scanner` is not defined on `Loader` in union `@Todo | Loader`
+ lib/spack/spack/vendor/ruamel/yaml/main.py:1105:13: error[unresolved-attribute] Attribute `_scanner` is not defined on `Loader` in union `Unknown | Loader`
- Found 4382 diagnostics
+ Found 4384 diagnostics

beartype (https://github.com/beartype/beartype)
- beartype/_decor/_nontype/decornontype.py:156:59: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- beartype/_decor/_nontype/decornontype.py:215:63: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ beartype/vale/_core/_valecore.py:322:30: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 515 diagnostics
+ Found 514 diagnostics

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/middleware/profiler.py:135:28: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/werkzeug/utils.py:515:19: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 387 diagnostics
+ Found 389 diagnostics

websockets (https://github.com/aaugustin/websockets)
+ src/websockets/legacy/server.py:632:29: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/websockets/legacy/server.py:632:29: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/websockets/legacy/server.py:632:29: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 41 diagnostics
+ Found 44 diagnostics

paasta (https://github.com/yelp/paasta)
+ paasta_tools/async_utils.py:168:21: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1063 diagnostics
+ Found 1064 diagnostics

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/downloadermiddlewares/retry.py:110:22: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ scrapy/downloadermiddlewares/retry.py:110:22: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1774 diagnostics
+ Found 1776 diagnostics

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/python.py:475:28: error[call-non-callable] Object of type `Class` is not callable
+ src/_pytest/python.py:475:28: error[call-non-callable] Object of type `<Protocol with members 'pytest_generate_tests'>` is not callable
- Found 390 diagnostics
+ Found 392 diagnostics

kopf (https://github.com/nolar/kopf)
+ kopf/_core/engines/daemons.py:471:17: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ kopf/_core/engines/daemons.py:471:17: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ kopf/_core/engines/daemons.py:541:17: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ kopf/_core/engines/daemons.py:541:17: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ kopf/_core/intents/registries.py:485:16: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 290 diagnostics
+ Found 295 diagnostics

starlette (https://github.com/encode/starlette)
+ starlette/_exception_handler.py:59:42: error[invalid-argument-type] Argument is incorrect: Expected `Request[State]`, found `Request[State] | WebSocket[State]`
- starlette/middleware/errors.py:181:23: error[call-non-callable] Object of type `None` is not callable

graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/language/visitor.py:266:34: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[int | str, Node]`, found `tuple[None | Any | int | Node, @Todo & ~Literal[VisitorActionEnum.BREAK] & ~Literal[True] & ~Literal[VisitorActionEnum.SKIP] & ~Literal[False] & ~None]`
+ src/graphql/language/visitor.py:266:34: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[int | str, Node]`, found `tuple[None | Any | int | Node, Literal[VisitorActionEnum.REMOVE]]`
+ src/graphql/type/definition.py:302:12: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 638 diagnostics
+ Found 639 diagnostics

ignite (https://github.com/pytorch/ignite)
+ ignite/handlers/base_logger.py:48:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 2135 diagnostics
+ Found 2136 diagnostics

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

rich (https://github.com/Textualize/rich)
+ rich/_log_render.py:60:36: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ rich/text.py:622:31: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ rich/text.py:622:31: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 351 diagnostics
+ Found 354 diagnostics

pylox (https://github.com/sco1/pylox)
- pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[None | Unknown]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`
+ pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[Unknown | None]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`

dulwich (https://github.com/dulwich/dulwich)
- dulwich/object_store.py:2922:12: error[unsupported-operator] Operator `in` is not supported between objects of type `ObjectID` and `Unknown | ((() -> dict[ObjectID, ObjectID]) & ~AlwaysTruthy & ~AlwaysFalsy) | dict[Unknown, Unknown]`
+ dulwich/object_store.py:2922:12: error[unsupported-operator] Operator `in` is not supported between objects of type `ObjectID` and `Unknown | ((() -> dict[ObjectID, ObjectID]) & ~AlwaysTruthy & ~AlwaysFalsy) | (dict[ObjectID, ObjectID] & ~AlwaysFalsy) | dict[Unknown, Unknown]`
- dulwich/pack.py:2324:78: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ dulwich/pack.py:3587:13: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ dulwich/repo.py:2711:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ dulwich/worktree.py:570:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ dulwich/worktree.py:570:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 224 diagnostics
+ Found 227 diagnostics

nox (https://github.com/wntrblm/nox)
+ nox/_option_set.py:162:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ nox/_option_set.py:162:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 21 diagnostics
+ Found 23 diagnostics

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/utils/cache.py:147:21: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 986 diagnostics
+ Found 987 diagnostics

PyGithub (https://github.com/PyGithub/PyGithub)
+ github/Auth.py:199:27: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- github/MainClass.py:999:80: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/core/marks.py:34:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 318 diagnostics
+ Found 319 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_validators.py:65:36: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- pydantic/json_schema.py:551:44: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 3204 diagnostics
+ Found 3202 diagnostics

tornado (https://github.com/tornadoweb/tornado)
+ tornado/escape.py:352:28: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ tornado/tcpclient.py:258:27: error[invalid-assignment] Object of type `_ComplexLike` is not assignable to `int | float | timedelta | None`
- Found 323 diagnostics
+ Found 325 diagnostics

vision (https://github.com/pytorch/vision)
+ test/datasets_utils.py:835:57: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ test/datasets_utils.py:835:57: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ test/datasets_utils.py:956:57: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ test/datasets_utils.py:956:57: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1543:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1597:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1684:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
- test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1739:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ torchvision/models/_utils.py:201:43: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1438 diagnostics
+ Found 1443 diagnostics

artigraph (https://github.com/artigraph/artigraph)
+ src/arti/types/bigquery.py:102:13: error[unknown-argument] Argument `description` does not match any known parameter
+ src/arti/types/bigquery.py:102:44: error[unknown-argument] Argument `nullable` does not match any known parameter
+ src/arti/types/bigquery.py:102:72: error[unknown-argument] Argument `precision` does not match any known parameter
+ src/arti/types/pyarrow.py:292:30: error[invalid-argument-type] Argument is incorrect: Expected `Literal["second", "millisecond", "microsecond", "nanosecond"]`, found `str`
+ src/arti/types/pyarrow.py:292:30: error[unknown-argument] Argument `precision` does not match any known parameter
+ src/arti/types/python.py:69:16: error[invalid-return-type] Return type does not match returned value: expected `Type`, found `_ContainerMixin`
- tests/arti/types/test_types.py:100:51: error[invalid-argument-type] Argument is incorrect: Expected `frozenset[Any]`, found `frozenset[float | Unknown | int] | list[Unknown | int | float] | tuple[float | Unknown | int, ...]`
+ tests/arti/types/test_types.py:100:51: error[invalid-argument-type] Argument is incorrect: Expected `frozenset[Any]`, found `frozenset[float | Unknown | int] | list[int | Unknown | float] | tuple[float | Unknown | int, ...]`
- Found 149 diagnostics
+ Found 155 diagnostics

pandera (https://github.com/pandera-dev/pandera)
- pandera/engines/numpy_engine.py:64:38: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 1634 diagnostics
+ Found 1633 diagnostics

psycopg (https://github.com/psycopg/psycopg)
+ psycopg_pool/psycopg_pool/pool.py:652:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ psycopg_pool/psycopg_pool/pool.py:662:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 655 diagnostics
+ Found 657 diagnostics

koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/_internal.py:129:23: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[SuccessT@_ToTupleStandardValidator] | Nothing`
+ koda_validate/_internal.py:157:23: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[SuccessT@_ToTupleStandardValidator] | Nothing`
+ koda_validate/_internal.py:220:30: error[unresolved-attribute] Attribute `val` is not defined on `Invalid` in union `Valid[Any] | Invalid`
+ koda_validate/_internal.py:254:30: error[unresolved-attribute] Attribute `val` is not defined on `Invalid` in union `Valid[A@_wrap_sync_validator] | Invalid`
+ koda_validate/_internal.py:256:24: error[invalid-return-type] Return type does not match returned value: expected `tuple[Literal[True], A@_wrap_sync_validator] | tuple[Literal[False], Invalid]`, found `tuple[Literal[False], Valid[A@_wrap_sync_validator] | Invalid]`
+ koda_validate/dataclasses.py:173:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/dataclasses.py:224:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/dictionary.py:113:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/dictionary.py:169:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/list.py:48:42: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[list[Any]] | Nothing`
+ koda_validate/list.py:85:42: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[list[Any]] | Nothing`
+ koda_validate/namedtuple.py:166:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/namedtuple.py:217:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/set.py:45:41: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[set[Any]] | Nothing`
+ koda_validate/set.py:88:41: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[set[Any]] | Nothing`
+ koda_validate/signature.py:299:29: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `Valid[Any] | Invalid` on object of type `dict[str, Invalid]`
+ koda_validate/signature.py:301:50: error[unresolved-attribute] Attribute `val` is not defined on `Invalid` in union `Valid[Any] | Invalid`
+ koda_validate/signature.py:304:46: error[unresolved-attribute] Attribute `val` is not defined on `Invalid` in union `Valid[Any] | Invalid`
+ koda_validate/signature.py:306:25: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `Valid[Any] | Invalid` on object of type `dict[str, Invalid]`
+ koda_validate/signature.py:315:46: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Invalid`, found `Valid[Any] | Invalid`
+ koda_validate/tuple.py:294:48: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[tuple[Any, ...]] | Nothing`
+ koda_validate/tuple.py:335:48: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[tuple[Any, ...]] | Nothing`
+ koda_validate/tuple.py:415:48: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[tuple[Any, ...]] | Nothing`
+ koda_validate/tuple.py:459:48: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[tuple[Any, ...]] | Nothing`
+ koda_validate/typeddict.py:167:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
+ koda_validate/typeddict.py:209:47: error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[dict[Any, Any]] | Nothing`
- Found 397 diagnostics
+ Found 423 diagnostics

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/compilers/compilers.py:1486:26: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ mesonbuild/compilers/compilers.py:1486:26: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ mesonbuild/compilers/d.py:540:30: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ mesonbuild/compilers/mixins/clike.py:368:40: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ mesonbuild/compilers/vala.py:183:26: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ mesonbuild/compilers/vala.py:183:26: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- mesonbuild/dependencies/detect.py:190:16: error[invalid-return-type] Return type does not match returned value: expected `list[DependencyCandidate[ExternalDependency]]`, found `list[Unknown | DependencyCandidate[Unknown]] | list[Unknown | (((Environment, DependencyObjectKWs, /) -> list[DependencyCandidate[ExternalDependency]]) & DependencyCandidate[object] & ~type) | (DependencyCandidate[Unknown] & ~type)] | @Todo`
+ mesonbuild/dependencies/detect.py:190:16: error[invalid-return-type] Return type does not match returned value: expected `list[DependencyCandidate[ExternalDependency]]`, found `list[Unknown | DependencyCandidate[Unknown]] | list[Unknown | (((Environment, DependencyObjectKWs, /) -> list[DependencyCandidate[ExternalDependency]]) & DependencyCandidate[object] & ~type) | (DependencyCandidate[Unknown] & ~type)] | list[DependencyCandidate[ExternalDependency]]`
+ mesonbuild/interpreter/interpreterobjects.py:928:16: error[invalid-return-type] Return type does not match returned value: expected `str | int | Sequence[Divergent] | ... omitted 5 union elements`, found `Unknown | str | int | ... omitted 7 union elements`
- Found 2206 diagnostics
+ Found 2213 diagnostics

cloud-init (https://github.com/canonical/cloud-init)
- tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`
- tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`

freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/strategy/informative_decorator.py:157:49: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ freqtrade/strategy/informative_decorator.py:157:49: error[missing-argument] No argument provided for required parameter 1
+ freqtrade/strategy/informative_decorator.py:157:59: error[unknown-argument] Argument `column` does not match any known parameter
+ freqtrade/strategy/informative_decorator.py:159:19: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ freqtrade/strategy/informative_decorator.py:159:19: error[missing-argument] No argument provided for required parameter 1
+ freqtrade/strategy/informative_decorator.py:159:29: error[unknown-argument] Argument `column` does not match any known parameter
- Found 655 diagnostics
+ Found 661 diagnostics

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/core/cache.py:487:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ openlibrary/core/cache.py:504:23: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ openlibrary/plugins/worksearch/code.py:273:34: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ openlibrary/plugins/worksearch/schemes/__init__.py:75:33: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ openlibrary/plugins/worksearch/schemes/__init__.py:81:24: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1140 diagnostics
+ Found 1145 diagnostics

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/types/fields/resolver.py:250:16: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 344 diagnostics
+ Found 345 diagnostics

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:435:33: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/hydra_zen/wrapper/_implementations.py:437:60: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 518 diagnostics
+ Found 516 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
+ src/integrations/prefect-dask/prefect_dask/task_runners.py:354:25: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/integrations/prefect-dask/prefect_dask/task_runners.py:354:25: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/prefect/flow_engine.py:1691:43: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Unknown | R@run_generator_flow_sync`
+ src/prefect/flow_engine.py:1699:21: error[unresolved-attribute] Attribute `throw` is not defined on `R@run_generator_flow_sync` in union `Unknown | R@run_generator_flow_sync`
+ src/prefect/flow_engine.py:1733:44: error[unresolved-attribute] Attribute `__anext__` is not defined on `R@run_generator_flow_async` in union `Unknown | R@run_generator_flow_async`
+ src/prefect/flow_engine.py:1740:25: error[unresolved-attribute] Attribute `throw` is not defined on `R@run_generator_flow_async` in union `Unknown | R@run_generator_flow_async`
- src/prefect/flows.py:1886:53: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/prefect/flows.py:1946:21: error[no-matching-overload] No overload of function `run_coro_as_sync` matches arguments
- src/prefect/server/models/workers.py:299:64: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/prefect/server/models/workers.py:298:19: error[missing-argument] No arguments provided for required parameters 1, 2, 3, 4
+ src/prefect/server/models/workers.py:300:17: error[unknown-argument] Argument `occurred` does not match any known parameter
+ src/prefect/server/models/workers.py:301:17: error[unknown-argument] Argument `pre_update_work_pool` does not match any known parameter
+ src/prefect/server/models/workers.py:302:17: error[unknown-argument] Argument `work_pool` does not match any known parameter
+ src/prefect/tasks.py:569:40: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/prefect/tasks.py:569:40: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/prefect/tasks.py:569:40: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- src/prefect/tasks.py:1635: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/tasks.py:1635: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]] | Any`
+ src/prefect/utilities/_engine.py:40:25: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/prefect/utilities/_engine.py:66:29: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/prefect/utilities/_engine.py:69:29: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 5488 diagnostics
+ Found 5503 diagnostics

setuptools (https://github.com/pypa/setuptools)
+ setuptools/config/_apply_pyprojecttoml.py:82:13: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ setuptools/config/expand.py:329:14: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1116 diagnostics
+ Found 1118 diagnostics

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/aglib/heap/ptmalloc.py:268:30: error[call-non-callable] Object of type `~None & ~Type` is not callable
- pwndbg/aglib/heap/ptmalloc.py:269:28: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `Value | None | @Todo`
+ pwndbg/aglib/heap/ptmalloc.py:269:28: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `Value | None | Unknown`
+ pwndbg/aglib/heap/ptmalloc.py:600:30: error[call-non-callable] Object of type `~None & ~Type` is not callable
- pwndbg/aglib/heap/ptmalloc.py:602:28: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `Value | None | @Todo`
+ pwndbg/aglib/heap/ptmalloc.py:602:28: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `Value | None | Unknown`
+ pwndbg/commands/ptmalloc2.py:53:15: error[call-non-callable] Object of type `~None` is not callable
- Found 1882 diagnostics
+ Found 1885 diagnostics

xarray (https://github.com/pydata/xarray)
+ xarray/core/common.py:518:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ xarray/core/dataarray.py:3250:21: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ xarray/core/dataset.py:5880:21: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ xarray/core/datatree_render.py:287:21: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 1709 diagnostics
+ Found 1713 diagnostics

archinstall (https://github.com/archlinux/archinstall)
+ archinstall/lib/output.py:33:12: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 69 diagnostics
+ Found 70 diagnostics

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/IO/_PBES.py:353:38: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `str`, found `@Todo | bytes`
+ lib/Crypto/IO/_PBES.py:353:38: error[invalid-argument-type] Argument to function `scrypt` is incorrect: Expected `str`, found `Unknown | bytes`
- lib/Crypto/Math/_IntegerBase.py:338:20: error[invalid-argument-type] Argument to function `bord` is incorrect: Expected `bytes`, found `@Todo | int`
+ lib/Crypto/Math/_IntegerBase.py:338:20: error[invalid-argument-type] Argument to function `bord` is incorrect: Expected `bytes`, found `Unknown | int`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[Unknown | str]` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[str | Unknown]` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/internal/settings/_config.py:310:35: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ ddtrace/internal/settings/_config.py:310:35: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ ddtrace/internal/settings/_config.py:310:35: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ ddtrace/internal/settings/_config.py:310:35: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ ddtrace/internal/settings/_config.py:310:35: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- scripts/freshvenvs.py:343:69: error[invalid-argument-type] Argument to function `_versions_fully_cover_bounds` is incorrect: Expected `list[str]`, found `list[Unknown | Version] & ~AlwaysFalsy`
+ scripts/freshvenvs.py:343:69: error[invalid-argument-type] Argument to function `_versions_fully_cover_bounds` is incorrect: Expected `list[str]`, found `list[Version | Unknown] & ~AlwaysFalsy`
- Found 9037 diagnostics
+ Found 9042 diagnostics

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/property/bases.py:188:20: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/bokeh/core/property/instance.py:106:29: error[invalid-assignment] Object of type `type[T@Object]` is not assignable to `type[Serializable]`
+ src/bokeh/core/property/instance.py:108:13: error[invalid-assignment] Object of type `type[Serializable]` is not assignable to attribute `_instance_type` of type `type[T@Object] | (() -> type[T@Object]) | str`
+ src/bokeh/io/notebook.py:566:18: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/bokeh/io/notebook.py:578:15: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/bokeh/plotting/graph.py:123:28: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ src/bokeh/resources.py:473:41: error[invalid-argument-type] Argument to function `__call__` is incorrect: Expected `list[str]`, found `list[Literal["bokeh", "bokeh-gl", "bokeh-widgets", "bokeh-tables", "bokeh-mathjax", "bokeh-api"]]`
+ src/bokeh/server/views/metadata_handler.py:60:24: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- src/bokeh/settings.py:414:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.IMMEDIATE]]`
+ src/bokeh/settings.py:414:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.IMMEDIATE]]`
- src/bokeh/settings.py:418:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.USER_SET]]`
+ src/bokeh/settings.py:418:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.USER_SET]]`
+ src/bokeh/settings.py:418:34: error[invalid-argument-type] Argument is incorrect: Expected `T@PrioritizedSetting | str`, found `str | (T@PrioritizedSetting & ~<class '_Unset'>) | (type[_Unset] & ~<class '_Unset'>)`
- src/bokeh/settings.py:422:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.CONFIG_OVERRIDE]]`
+ src/bokeh/settings.py:422:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.CONFIG_OVERRIDE]]`
- src/bokeh/settings.py:426:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.ENV_VAR]]`
+ src/bokeh/settings.py:426:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.ENV_VAR]]`
- src/bokeh/settings.py:430:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.CONFIG_USER]]`
+ src/bokeh/settings.py:430:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.CONFIG_USER]]`
- src/bokeh/settings.py:434:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.CONFIG_SYSTEM]]`
+ src/bokeh/settings.py:434:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.CONFIG_SYSTEM]]`
- src/bokeh/settings.py:438:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.DEV_DEFAULT]]`
+ src/bokeh/settings.py:438:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.DEV_DEFAULT]]`
+ src/bokeh/settings.py:438:34: error[invalid-argument-type] Argument is incorrect: Expected `T@PrioritizedSetting | str`, found `(Unknown & ~<class '_Unset'>) | (T@PrioritizedSetting & ~<class '_Unset'>) | (type[_Unset] & ~<class '_Unset'>)`
- src/bokeh/settings.py:442:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.DEFAULT]]`
+ src/bokeh/settings.py:442:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.DEFAULT]]`
+ src/bokeh/settings.py:442:34: error[invalid-argument-type] Argument is incorrect: Expected `T@PrioritizedSetting | str`, found `(T@PrioritizedSetting & ~<class '_Unset'>) | (type[_Unset] & ~<class '_Unset'>)`
- src/bokeh/settings.py:446:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | str, Literal[SettingProvenance.GLOBAL_DEFAULT]]`
+ src/bokeh/settings.py:446:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[T@PrioritizedSetting, SettingProvenance]`, found `tuple[Unknown | T@PrioritizedSetting | str, Literal[SettingProvenance.GLOBAL_DEFAULT]]`
+ src/bokeh/settings.py:446:34: error[invalid-argument-type] Argument is incorrect: Expected `T@PrioritizedSetting | str`, found `(Unknown & ~<class '_Unset'>) | (T@PrioritizedSetting & ~<class '_Unset'>) | (type[_Unset] & ~<class '_Unset'>)`
- Found 840 diagnostics
+ Found 852 diagnostics

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/sql/datatypes.py:1728:25: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Unknown | Float16 | Float32 | ... omitted 5 union elements`
- ibis/expr/operations/core.py:65:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `(@Todo & ~Value[object, object]) | None`
+ ibis/expr/operations/core.py:65:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc`, found `(Any & ~Expr & ~Value[object, object]) | None`
- ibis/expr/operations/core.py:67:36: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsFloat | SupportsIndex`, found `(@Todo & ~Value[object, object]) | None`
+ ibis/expr/operations/core.py:67:36: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | Buffer | SupportsFloat | SupportsIndex`, found `(Any & ~Expr & ~Value[object, object]) | None`
- ibis/expr/types/temporal.py:324:23: error[invalid-argument-type] Argument is incorrect: Expected `Value[Time | Timestamp, Any]`, found `@Todo | Self@between`
+ ibis/expr/types/temporal.py:324:23: error[invalid-argument-type] Argument is incorrect: Expected `Value[Time | Timestamp, Any]`, found `Unknown | Self@between`
+ ibis/expr/visualize.py:122:46: error[invalid-argument-type] Argument is incorrect: Expected `ibis.expr.operations.core.Node`, found `ibis.common.graph.Node`
+ ibis/expr/visualize.py:132:50: error[invalid-argument-type] Argument is incorrect: Expected `ibis.expr.operations.core.Node`, found `ibis.common.graph.Node`
+ ibis/expr/visualize.py:164:50: error[invalid-argument-type] Argument is incorrect: Expected `ibis.expr.operations.core.Node`, found `ibis.common.graph.Node`
+ ibis/expr/visualize.py:164:53: error[invalid-argument-type] Argument is incorrect: Expected `ibis.expr.operations.core.Node`, found `ibis.common.graph.Node`
- ibis/legacy/udf/vectorized.py:188:5: error[invalid-assignment] Object of type `Attribute` is not assignable to attribute `columns` on type `@Todo | DataFrame`
+ ibis/legacy/udf/vectorized.py:188:5: error[invalid-assignment] Object of type `Attribute` is not assignable to attribute `columns` on type `Unknown | DataFrame`
- ibis/selectors.py:333:16: error[invalid-return-type] Return type does not match returned value: expected `frozenset[str]`, found `frozenset[Unknown | str | Buffer]`
+ ibis/selectors.py:333:16: error[invalid-return-type] Return type does not match returned value: expected `frozenset[str]`, found `frozenset[str | Buffer | Unknown]`
- ibis/selectors.py:428:13: error[invalid-assignment] Object of type `frozenset[Unknown | str]` is not assignable to `tuple[str | Column, ...]`
+ ibis/selectors.py:428:13: error[invalid-assignment] Object of type `frozenset[str | Unknown]` is not assignable to `tuple[str | Column, ...]`
+ ibis/selectors.py:456:28: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 4865 diagnostics
+ Found 4871 diagnostics

pywin32 (https://github.com/mhammond/pywin32)
+ com/win32com/server/policy.py:145:18: error[call-non-callable] Object of type `str` is not callable
- Found 2733 diagnostics
+ Found 2734 diagnostics

hydpy (https://github.com/hydpy-dev/hydpy)
+ hydpy/exe/xmltools.py:2373:20: error[invalid-assignment] Object of type `SetItem` is not assignable to `_TypeSetOrAddOrMultiplyItem@_get_changeitem`
- Found 651 diagnostics
+ Found 652 diagnostics

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/navigation/page.py:340:17: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
+ lib/streamlit/web/server/server_util.py:104:13: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- Found 13 diagnostics
+ Found 15 diagnostics

static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/container_util.py:496:25: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/container_util.py:497:59: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/container_util.py:1859:36: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/container_util.py:1875:41: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/container_util.py:1876:56: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/container_util.py:1890:50: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/frame.py:6623:44: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/core/frame.py:6612:39: error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[int]` with length 1
+ static_frame/core/frame.py:6658:40: error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[int]` with length 1
- static_frame/core/frame.py:6663:47: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/frame.py:6668:69: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/frame.py:6671:55: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/core/frame.py:6661:64: error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[int]` with length 1
+ static_frame/core/frame.py:6667:20: error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[int]` with length 1
+ static_frame/core/frame.py:6672:40: error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[int]` with length 1
+ static_frame/core/index.py:1001:32: error[call-top-callable] Object of type `Top[(...) -> object]` is not safe to call; its signature is not known
- static_frame/core/index_auto.py:139:63: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/index_auto.py:142:68: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/series.py:2510:78: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/test/unit/test_bus.py:2137:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `ndarray[Any, Any] | @Todo | Series[Any, Any]`
+ static_frame/test/unit/test_bus.py:2137:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `@Todo | Series[Any, Any] | ndarray[Any, Any]`
- static_frame/test/unit/test_bus.py:2138:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `ndarray[Any, Any] | @Todo | Series[Any, Any]`
+ static_frame/test/unit/test_bus.py:2138:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `@Todo | Series[Any, Any] | ndarray[Any, Any]`
- static_frame/test/unit/test_bus.py:2166:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `ndarray[Any, Any] | @Todo | Series[Any, Any]`
+ static_frame/test/unit/test_bus.py:2166:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `@Todo | Series[Any, Any] | ndarray[Any, Any]`
- static_frame/test/unit/test_bus.py:2167:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `ndarray[Any, Any] | @Todo | Series[Any, Any]`
+ static_frame/test/unit/test_bus.py:2167:26: error[unresolved-attribute] Attribute `to_pairs` is not defined on `ndarray[Any, Any]` in union `@Todo | Series[Any, Any] | ndarray[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1389:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1389:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1397:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1397:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1408:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1408:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1411:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1411:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1431:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1431:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1439:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1439:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1481:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1481:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1489:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1489:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1549:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_

... (truncated 419 lines) ...

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 9, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
call-top-callable 94 0 0
unresolved-attribute 30 0 16
invalid-argument-type 25 0 14
unused-type-ignore-comment 0 25 0
call-non-callable 16 1 0
invalid-return-type 3 0 14
unknown-argument 15 0 0
missing-argument 12 0 0
invalid-assignment 6 0 1
index-out-of-bounds 5 0 0
too-many-positional-arguments 5 0 0
unsupported-operator 1 0 3
no-matching-overload 3 0 0
Total 215 26 48

Full report with detailed diff (timing results)

Implement proper handling for calling intersection types. Previously,
calling an intersection type would return a `@Todo` type that suppressed
errors but provided no useful type information.

Now, when calling an intersection type:
- We try to call each positive element with the given arguments
- Elements where the call fails (wrong arguments, not callable, etc.)
  are discarded
- If at least one element succeeds, the call is valid
- The return type is the intersection of return types from successful
  elements
- If all elements fail, an appropriate error is reported

This approach means that if an intersection contains both a callable
with a known signature and a `Top[Callable[..., object]]` (from
narrowing by `callable()`), the call will succeed using the element
with the known signature, avoiding spurious `call-top-callable` errors.

Fixes astral-sh/ty#1858
@carljm carljm force-pushed the claude/fix-issue-1858-UjARA branch from 3dae02a to f39370a Compare January 9, 2026 04:00
claude added 7 commits January 9, 2026 04:09
When calling an intersection type where all callable elements reject
the specific call arguments, we now show an error for each failing
element (similar to how unions work) instead of a single generic
"not callable" error.

This is achieved by:
- Not filtering out failed elements when ALL elements fail
- Returning BindingError instead of NotCallable to trigger individual diagnostics
- Adding IntersectionDiagnostic struct and CompoundDiagnostic trait
- Modifying report_diagnostics to iterate over intersection elements
More diagnostics are now emitted due to showing individual errors
when all intersection elements fail a call.
When all intersection elements fail a call, we now use a priority
hierarchy to determine which errors to show:

1. NotCallable (lowest) - object has no __call__ method
2. TopCallable - object is a top callable with unknown signature
3. BindingError (highest) - specific errors like invalid-argument-type

Only errors from the highest priority category are shown. This prevents
noise from less-specific errors when more informative errors are available.

For example, if an intersection has one element that fails with
invalid-argument-type and another that's not callable, we only show
the invalid-argument-type error since it's more specific and actionable.
Refactors the `Bindings` structure to use a two-level representation:
- Outer level: union elements (each can be a single callable or an intersection)
- Inner level: bindings within an intersection element

This enables proper handling of types like `(A & B) | C` when calling,
where `A & B` is an intersection that was narrowed by `callable()`.

Key changes:
- Add `BindingsElement` struct to represent a single union element
  (which may contain multiple bindings for intersections)
- Update `from_union` to preserve intersection structure instead of
  flattening
- Update `from_intersection` to create a single element with multiple
  bindings
- Update `return_type`, `check_types_impl`, and `report_diagnostics`
  to handle the two-level structure
- Add test for union-of-intersections case

The priority hierarchy for intersection call errors is preserved: when
all bindings in an intersection fail, only the highest-priority error
type is reported (BindingError > TopCallable > NotCallable).
Resolves conflicts between the two-level Bindings structure and
main's new Type match cases for property descriptors, dataclass
transformers, and other features.
@carljm carljm force-pushed the claude/fix-issue-1858-UjARA branch 4 times, most recently from 06c217d to f72e874 Compare January 9, 2026 20:46
This PR fixes false `invalid-await` errors for patterns like:
```python
if inspect.isawaitable(x):
    await x  # x has type Unknown & Awaitable[object]
```

Changes:
1. Add intersection handling to `generator_return_type()` so that await
   operations on intersection types work correctly. When awaiting an
   intersection, we iterate over positive elements, collect return types
   from awaitable elements, and intersect them together. Non-awaitable
   elements are skipped; only if all elements fail to be awaitable do we
   report an error.

2. Add intersection handling to `try_call_dunder_with_policy()` to call
   dunder methods on each intersection element separately and combine the
   results. This avoids intersecting bound methods (which often collapses
   to Never) and instead intersects the return types.

Added tests for:
- Awaiting `Unknown & Awaitable[object]` returns `Unknown`
- Awaiting intersection of two Coroutine types
- Awaiting intersection with non-awaitable elements skips those elements
- Awaiting intersection where all elements are non-awaitable produces error
@carljm carljm force-pushed the claude/fix-issue-1858-UjARA branch from f72e874 to 01b1937 Compare January 9, 2026 21:04
When multiple bindings in an intersection (or multiple elements in a union)
return argument forms from type checking (e.g., during argument type expansion),
we should merge them to properly detect conflicting forms, rather than
overwriting with the last one.
Use error priority to select the appropriate error kind when all bindings
fail, rather than handling intersection and single-binding cases separately.
This addresses review comments 2 and 3 from PR #22469.
Update the doc comment to clarify that Bindings represents a union of
callables (possibly size one), where each element is an intersection
(possibly size one). This addresses review comment 5 from PR #22469.
…allable()

- Add is_callable() method to BindingsElement for clearer element-level checks
- Update report_diagnostics to iterate over elements instead of flattened bindings
- Add documentation to iter() and iter_mut() clarifying they flatten the structure

This addresses review comments 6 and 7 from PR #22469.
Simplify the call site by moving the is_intersection() and as_result().is_ok()
checks inside retain_successful(). This addresses review comment 8 from PR #22469.
When an intersection fails inside a union, report errors with both
union and intersection context:
- Add LayeredDiagnostic that combines both contexts
- Show the correct intersection type (not the full union)
- Include test with snapshot diagnostics demonstrating the layered output

This addresses review comment 9 from PR #22469.
@carljm carljm marked this pull request as ready for review February 15, 2026 04:53
* main:
  Update ecosystem-analyzer to latest commit (#23287)
  [ty] support narrowing from Callable returning type guard (#23280)
  [ty] Update CONFORMANCE_SUITE_COMMIT to new hash (#23276)
  [ty] Sync vendored typeshed stubs (#23279)
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Awesome!

This is a test-only review so far. There are a few tests that don't test what they say they're testing.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

(still not a complete review -- will pick it back up tomorrow!)

Copy link
Contributor Author

@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.

Thanks for the review!

# Diagnostics

```
error[invalid-argument-type]: Argument to bound method `__call__` is incorrect
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks verbose in this contrived example, but I think in real code it's pretty unlikely to call a union containing an intersection where all elements of the union and the intersection all fail the call, and all elements of the intersection have the same "priority" error. And if that did happen, you might well want to know the details on each failed element.

@carljm carljm requested a review from AlexWaygood February 16, 2026 01:02
@AlexWaygood AlexWaygood self-assigned this Feb 16, 2026
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice!

I feel like @dhruvmanila and @dcreager probably have more expertise than me on our call-binding machinery, so it would be great to have one of them take a look at this -- but I don't think that needs to block landing this.

Great work!

Binding::single(self, Signature::todo("Type::Intersection.call")).into()
Type::Intersection(intersection) => {
// For intersections, we try to call each positive element.
// Elements where the call fails are discarded.
Copy link
Member

Choose a reason for hiding this comment

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

This second sentence doesn't seem strictly true? All elements fail in this call, but we do not "discard" the elements on your branch -- we emit two diagnostics, but we correctly infer call as evaluating to A & B:

from ty_extensions import Intersection

class A: ...
class B: ...

class C:
    def __call__(self, arg: str) -> A:
        return A()

class D:
    def __call__(self, arg: str) -> B:
        return B()

def f(cd: Intersection[C, D]):
    reveal_type(cd(42))

Would it be more accurate to say that "non-callable elements are discarded"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If some elements succeed and others fail, the return type is based only on the successful calls. This is tested in the "Three or more elements with partial success" mdtest:

from ty_extensions import Intersection

class RetA: ...
class RetB: ...

class A:
    def __call__(self) -> RetA:
        return RetA()

class B:
    def __call__(self) -> RetB:
        return RetB()

class C:
    def __call__(self, x: int) -> int:
        return 1

def _(x: Intersection[A, B, C]) -> None:
    # A() succeeds, B() succeeds, C() fails (needs int arg) -> discarded
    reveal_type(x())  # revealed: RetA & RetB

But if all elements fail (as in the test you showed), we don't want to give the return type as Never, so we give as our best guess the intersection of all of their return types.

I just deleted this comment here, as it's an overly-simplified description of logic that doesn't even live here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, there is one more wrinkle around top-callables. In their case, the call "fails" because the arguments might be wrong -- but we know by the nature of a top-callable that somewhere in that infinite union, there is a callable subtype which does accept the current call arguments. So we still intersect the return type of the top-callable into the return type, even though calling the top-callable "failed". This is important to not lose narrowing information in some cases.

Comment on lines +5399 to +5403
/// Trait for adding context about compound types (unions/intersections) to diagnostics.
trait CompoundDiagnostic {
/// Adds context about any relevant compound type function types to the given diagnostic.
fn add_context(&self, db: &dyn Db, diag: &mut Diagnostic);
}
Copy link
Member

Choose a reason for hiding this comment

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

I have somewhat mixed feelings about the way we try to attach all contextual subdiagnostics inside our call-binding infrastructure. I feel like I'd prefer it if we instead propagated that information out of the call-binding infrastucture for callers to do with what they wish. It would make issues like astral-sh/ty#2482 easier to fix -- it's very hard to attach a specific subdiagnostic right now at only one callsite if the diagnostic came from our generalised call-binding machinery. And this PR feels like it's doubling down on the current way of doing things even more.

Still, this shouldn't block this important PR from being merged. It's fine to ignore this grumble for now :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's reasonable! I feel pretty confident this isn't adding a lot more difficulty to that potential refactor over what we have today, though.

* main: (43 commits)
  [`ruff`] Suppress diagnostic for strings with backslashes in interpolations before Python 3.12 (`RUF027`) (#21069)
  [flake8-bugbear] Fix B023 false positive for immediately-invoked lambdas (#23294)
  [ty] Add `Final` mdtests for loops and redeclaration (#23331)
  [`flake8-pyi`] Also check string annotations (`PYI041`) (#19023)
  Remove AlexWaygood as a flake8-pyi codeowner (#23347)
  [ty] Add comments to clarify the purpose of `NominalInstanceType::class_name` and `NominalInstanceType::class_module_name` (#23339)
  Add attestations for release artifacts and Docker images (#23111)
  [ty] Fix `assert_type` diagnostic messages (#23342)
  [ty] Force-update all insta snapshots (#23343)
  Add Q004 to the list of conflicting rules (#23340)
  [ty] Fix `invalid-match-pattern` false positives (#23338)
  [ty] new diagnostic called-match-pattern-must-be-a-type (#22939)
  [ty] Update flaky projects  (#23337)
  [ty] Increase timeout for ecosystem report to 40 min (#23336)
  Bump ecosystem-analyzer pin  (#23335)
  [ty] Replace `strsim` with CPython-based Levenshtein implementation (#23291)
  [ty] Add mdtest for staticmethod assigned in class body (#23330)
  [ty] fix inferring type variable from string literal argument (#23326)
  [ty] bytes literal is a sequence of integers (#23329)
  Update rand and getrandom (#23333)
  ...
@carljm
Copy link
Contributor Author

carljm commented Feb 16, 2026

Thanks for the review! Given the pain of resolving merge conflicts here, I'm going to go ahead and merge with your review, but very open to post-land comments from @dhruvmanila or @dcreager (or anyone).

@carljm
Copy link
Contributor Author

carljm commented Feb 16, 2026

(With apologies to everyone else I'm certainly causing merge conflicts for, cc @charliermarsh)

@charliermarsh
Copy link
Member

I love merge conflicts if it means progress.

@carljm carljm merged commit 4b2f5e2 into main Feb 16, 2026
50 checks passed
@carljm carljm deleted the claude/fix-issue-1858-UjARA branch February 16, 2026 23:36
Comment on lines +241 to +245
if is_async_callable(fn):
reveal_type(fn) # revealed: ((int, /) -> int | Awaitable[int]) & Top[(...) -> Awaitable[object]]
result = fn(1)
# This includes `int & Awaitable[object]`: an `int` subtype could define `__await__`.
reveal_type(result) # revealed: (int & Awaitable[object]) | Awaitable[int]
Copy link
Member

Choose a reason for hiding this comment

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

Is this reveal type based on the fact that (A | B) & C gets distributed as (A & C) | (B & C) where Awaitable[int] & Awaitable[object] is simplified to Awaitable[int]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's right. This is another one of those cases where we'll handle narrowing more pedantically than other type checkers. People will expect the await below to yield int, but we'll yield object because we account for this (int & Awaitable[object]) -- the possibility of an unknown subclass of int which adds awaitability.

@dhruvmanila
Copy link
Member

Overall, LGTM!

(Oops, this comment didn't go through.)

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.

support calls to intersection types

5 participants