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

[mypyc] Detect if attribute definition conflicts with base class/trait #14535

Merged
merged 2 commits into from
Feb 5, 2023

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jan 27, 2023

Require that all the attribute definitions have the same type. Overriding with a different type is unsafe, and we don't want to add runtime checks when accessing an attribute that might be overridden with a different type. If the types would have different runtime representations, supporting that at all would be complicated.

Fixes mypyc/mypyc#970.

Require that all the attribute definitions have the same type.
Overriding with a different type is unsafe, and we don't want to add
runtime checks when accessing an attribute that might be overridden
with a different type. If the types would have different runtime
representations, supporting that at all would be complicated.

Fixes mypyc/mypyc#970.
@ichard26 ichard26 self-requested a review January 27, 2023 19:21
Copy link
Collaborator

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

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

First review on this repository. This seems good, but a sanity check from someone else would be appreciated!

@JukkaL JukkaL merged commit 332bb2d into master Feb 5, 2023
@JukkaL JukkaL deleted the native-int-attr-repr branch February 5, 2023 11:07
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.

Generate an error if subclass has a different type for an attribute
3 participants