Skip to content

Comments

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

Merged
dhruvmanila merged 2 commits intomainfrom
dhruv/callable-fix-gradual-equivalence
Mar 24, 2025
Merged

[red-knot] Fix gradual equivalence for callable types#16887
dhruvmanila merged 2 commits intomainfrom
dhruv/callable-fix-gradual-equivalence

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 ty 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
@github-actions
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

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants