Skip to content
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

[record] support abstract properties on base classes #22946

Conversation

alangenfeld
Copy link
Member

When working on #22860 I believed that class vars on abstract base classes acted similar to abstract property. While at runtime the class var does not exist if its not implemented on a child class, the type checker and runtime do not prevent you from omitting an implementation for that memeber on a concrete child class.

This address the issue by ensuring that NamedTuple fields that conflict are moved up to the __dict__ of the generated type so that their precedance is greater than the abstract property definition on any base class.

How I Tested These Changes

updated tests

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @alangenfeld and the rest of your teammates on Graphite Graphite

@alangenfeld alangenfeld force-pushed the al/07-10-_record_support_abstract_properties_on_base_classes branch from 9bbf4a2 to a20d3be Compare July 10, 2024 17:20
@alangenfeld alangenfeld force-pushed the al/07-10-_record_support_abstract_properties_on_base_classes branch from a20d3be to b3193b2 Compare July 10, 2024 17:23
Copy link
Contributor

@OwenKephart OwenKephart left a comment

Choose a reason for hiding this comment

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

excellent

@alangenfeld alangenfeld merged commit 9479480 into master Jul 10, 2024
1 check passed
@alangenfeld alangenfeld deleted the al/07-10-_record_support_abstract_properties_on_base_classes branch July 10, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants