Skip to content

Conversation

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Apr 12, 2025

Summary

This PR moves all the relation methods from CallableType to Signature.

The main reason for this is that Signature is going to be the common denominator between normal and overloaded callables and the core logic to check a certain relationship is going to just require the information that would exists on Signature. For example, to check whether an overloaded callable is a subtype of a normal callable, we need to check whether every overloaded signature is a subtype of the normal callable's signature. This "every" logic would become part of the CallableType and the core logic of checking the subtyping would exists on Signature.

@dhruvmanila dhruvmanila added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Apr 12, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 12, 2025

mypy_primer results

No ecosystem changes detected ✅

@dhruvmanila dhruvmanila force-pushed the dhruv/move-callable-type-relation branch from 56a3864 to 3fc5654 Compare April 14, 2025 20:29
@dhruvmanila dhruvmanila marked this pull request as ready for review April 14, 2025 21:43
Copy link
Member

@dcreager dcreager left a comment

Choose a reason for hiding this comment

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

It's much easier to verify that this is a pure move with git diff on the command line than in the PR view... 😅

@dhruvmanila
Copy link
Member Author

It's much easier to verify that this is a pure move with git diff on the command line than in the PR view... 😅

Interesting! Curious to know what your .gitconfig has in the [diff] section

@dhruvmanila dhruvmanila merged commit b5d529e into main Apr 14, 2025
23 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/move-callable-type-relation branch April 14, 2025 22:02
@dcreager
Copy link
Member

Interesting! Curious to know what your .gitconfig has in the [diff] section

[diff]
    algorithm = histogram
    colorMoved = zebra
    colorMovedWS = ignore-all-space

dcreager added a commit that referenced this pull request Apr 15, 2025
* main: (31 commits)
  [red-knot] Add some knowledge of `__all__` to `*`-import machinery (#17373)
  Update taiki-e/install-action digest to be7c31b (#17379)
  Update Rust crate mimalloc to v0.1.46 (#17382)
  Update PyO3/maturin-action action to v1.49.1 (#17384)
  Update Rust crate anyhow to v1.0.98 (#17380)
  dependencies: switch from `chrono` to `jiff`
  Update Rust crate bstr to v1.12.0 (#17385)
  [red-knot] Further optimize `*`-import visibility constraints (#17375)
  [red-knot] Minor 'member_lookup_with_policy' fix (#17407)
  [red-knot] Initial support for `dataclass`es (#17353)
  Sync vendored typeshed stubs (#17402)
  [red-knot] improve function/bound method type display (#17294)
  [red-knot] Move relation methods from `CallableType` to `Signature` (#17365)
  [syntax-errors] `await` outside async functions (#17363)
  [red-knot] optimize is_subtype_of for literals (#17394)
  [red-knot] add a large-union-of-string-literals benchmark (#17393)
  Update pre-commit dependencies (#17383)
  [red-knot] mypy_primer: Fail job on panic or internal errors (#17389)
  [red-knot] Document limitations of diagnostics-silencing in unreachable code (#17387)
  [red-knot] detect unreachable attribute assignments (#16852)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants