ruff/crates/ty_python_semantic/resources/mdtest/generics/pep695
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
..
aliases.md [ty] Add support for generic PEP695 type aliases (#20219) 2025-09-08 13:26:21 -07:00
classes.md [ty] Improve diagnostics for bad `@overload` definitions (#20745) 2025-10-07 21:52:57 +00:00
functions.md [ty] bidirectional type inference using function return type annotations (#20528) 2025-10-11 00:38:35 +00:00
variables.md [ty] Add mdtests that exercise constraint sets (#20319) 2025-09-10 13:22:19 -04:00
variance.md [ty] Fix subtyping for dynamic specializations (#20592) 2025-09-26 15:05:03 +02:00