ruff/crates/ty_python_semantic/resources/mdtest/assignment
Shunsuke Shibayama dc64c08633
[ty] bidirectional type inference using function return type annotations (#20528)
## Summary

Implements bidirectional type inference using function return type
annotations.

This PR was originally proposed to solve astral-sh/ty#1167, but this
does not fully resolve it on its own.
Additionally, I believe we need to allow dataclasses to generate their
own `__new__` methods, [use constructor return types ​​for
inference](5844c0103d/crates/ty_python_semantic/src/types.rs (L5326-L5328)),
and a mechanism to discard type narrowing like `& ~AlwaysFalsy` if
necessary (at a more general level than this PR).

## Test Plan

`mdtest/bidirectional.md` is added.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
2025-10-11 00:38:35 +00:00
..
annotations.md [ty] bidirectional type inference using function return type annotations (#20528) 2025-10-11 00:38:35 +00:00
augmented.md [ty] Remove special casing for tuple addition (#19636) 2025-07-30 16:25:42 +00:00
multi_target.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
unbound.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
walrus.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00