Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[red-knot] Fix gradual equivalence for callable types #16887

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Mar 21, 2025

Summary

As mentioned in #16698 (comment), part of #15382, this PR updates the is_gradual_equivalent_to implementation between callable types to be similar to is_equivalent_to and checks other attributes of parameters like name, optionality, and parameter kind.

Test Plan

Expand the existing test cases to consider other properties but not all similar to how the tests are structured for subtyping and assignability.

@dhruvmanila dhruvmanila added the red-knot Multi-file analysis & type inference label Mar 21, 2025
@dhruvmanila dhruvmanila changed the title [red-knot] Fix gradual equivalent relation [red-knot] Fix gradual equivalence for callable types Mar 21, 2025
Copy link
Contributor

github-actions bot commented Mar 21, 2025

mypy_primer results

No ecosystem changes detected ✅

@dhruvmanila dhruvmanila force-pushed the dhruv/callable-fix-gradual-equivalence branch from d714765 to f532589 Compare March 24, 2025 15:45
@dhruvmanila dhruvmanila marked this pull request as ready for review March 24, 2025 16:03
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I really like the pattern you've established of using a common function with a callback that implements the distinction between subtyping and assignability (or in this case, equivalence and gradual equivalence.)

@dhruvmanila dhruvmanila merged commit dd5b02a into main Mar 24, 2025
23 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/callable-fix-gradual-equivalence branch March 24, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants