-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ty] Fix classmethod + contextmanager + Self #22407
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
base: main
Are you sure you want to change the base?
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
|
|
||
| // For classmethod-like callables, bind to the owner class (or instance's meta type). | ||
| // For function-like callables, bind to the instance. | ||
| let self_type = if callable.is_classmethod_like(db) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this is somewhat redundant with the change in bind_self in signatures.rs. In both places I'm detecting whether the method is a classmethod in different ways. Open to alternatives, of course.
Summary
The test I've added illustrates the fix. Copying it here too:
Full disclosure: I've used LLMs for this PR, but the result is thoroughly reviewed by me before submitting. I'm excited about my first Rust contribution to Astral tools and will address feedback quickly.
Related to astral-sh/ty#2030, I am working on a fix for the TypeVar case also reported in that issue (by me)
Test Plan
Updated mdtests