Files
ruff/crates/ty_python_semantic/resources/mdtest/dataclasses
Claude f39370a6f5 [ty] Support calls to intersection types
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 https://github.com/astral-sh/ty/issues/1858
2026-01-09 04:00:02 +00:00
..