ruff
914095d0 - [red-knot] Super-basic generic inference at call sites (#17301)

Commit
158 days ago
[red-knot] Super-basic generic inference at call sites (#17301) This PR adds **_very_** basic inference of generic typevars at call sites. It does not bring in a full unification algorithm, and there are a few TODOs in the test suite that are not discharged by this. But it handles a good number of useful cases! And the PR does not add anything that would go away with a more sophisticated constraint solver. In short, we just look for typevars in the formal parameters, and assume that the inferred type of the corresponding argument is what that typevar should map to. If a typevar appears more than once, we union together the corresponding argument types. Cases we are not yet handling: - We are not widening literals. - We are not recursing into parameters that are themselves generic aliases. - We are not being very clever with parameters that are union types. --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Carl Meyer <carl@astral.sh>
Author
Parents
Loading