Skip to content

Conversation

@AlexWaygood
Copy link
Member

Summary

I thought we might have to add some new branches to Type::is_assignable_to here, similar to what we did for Callable types in #17717. But it turns out that it just falls out naturally from the logic we already have in place. A subclass of Any just returns a synthesized attribute of type Any for any member access where the member is not explicitly annotated on the subclass. And protocol subtyping/assignability works entirely through member access APIs on Type.

Test Plan

this PR is only tests

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label May 3, 2025
@AlexWaygood AlexWaygood enabled auto-merge (squash) May 3, 2025 12:40
@AlexWaygood AlexWaygood added the testing Related to testing Ruff itself label May 3, 2025
@AlexWaygood AlexWaygood merged commit b7d0b3f into main May 3, 2025
34 checks passed
@AlexWaygood AlexWaygood deleted the alex/protocol-any-subclass branch May 3, 2025 12:41
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2025

mypy_primer results

No ecosystem changes detected ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff itself ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants