ruff
dc64c086 - [ty] bidirectional type inference using function return type annotations (#20528)

Commit
86 days ago
[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](https://github.com/mtshiba/ruff/blob/5844c0103d30de4f8890414b38ce1a8d92d6f2d2/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>
Author
Parents
Loading