Skip to content

[red-knot] Support overloads for callable equivalence #17698

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Apr 29, 2025

Summary

Part of #15383, this PR adds is_equivalent_to support for overloaded callables.

This is mainly done by delegating it to the subtyping check in that two types A and B are considered equivalent if A is a subtype of B and B is a subtype of A.

Test Plan

Add test cases for overloaded callables in is_equivalent_to.md

@dhruvmanila dhruvmanila added the ty Multi-file analysis & type inference label Apr 29, 2025
Copy link
Contributor

github-actions bot commented Apr 29, 2025

mypy_primer results

No ecosystem changes detected ✅

@dhruvmanila dhruvmanila force-pushed the dhruv/overload-equivalence branch from 7b0d801 to 192dcf5 Compare April 29, 2025 13:48
@dhruvmanila dhruvmanila marked this pull request as ready for review April 29, 2025 14:32
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.

Nice!

@dhruvmanila dhruvmanila merged commit f11d9cb into main Apr 29, 2025
34 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/overload-equivalence branch April 29, 2025 21:24
dcreager added a commit that referenced this pull request Apr 30, 2025
* main:
  [red-knot] Use 'full' salsa backtrace output that includes durability and revisions (#17735)
  [red-knot] Initial support for protocol types (#17682)
  [red-knot] Computing a type ordering for two non-normalized types is meaningless (#17734)
  [red-knot] Include salsa backtrace in check and mdtest panic messages (#17732)
  [red-knot] Fix control flow for `assert` statements (#17702)
  [red-knot] Fix recording of negative visibility constraints (#17731)
  [red-knot] Update salsa (#17730)
  [red-knot] Support overloads for callable equivalence (#17698)
  [red-knot] Run py-fuzzer in CI to check for new panics (#17719)
  Upload red-knot binaries in CI on completion of linux tests (#17720)
  [`flake8-use-pathlib`] Fix `PTH123` false positive when `open` is passed a file descriptor from a function call (#17705)
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