Skip to content

Properly support @property members on protocols #1379

@AlexWaygood

Description

@AlexWaygood

If a protocol P has an @property member foo, we currently say that any nominal type N will satisfy P's interface if N has an attribute foo. This is obviously incorrect; we should also consider the type of the member foo on the protocol. For @property members with setters, we should also check whether the foo attribute can be set on N with the type the setter specifies.

Detailed tests for this are already in place at https://github.com/astral-sh/ruff/blob/main/crates/ty_python_semantic/resources/mdtest/protocols.md

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions