Skip to content

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

Merged
JukkaL merged 2 commits intomasterfrom
native-int-attr-repr
Feb 5, 2023
Merged

[mypyc] Detect if attribute definition conflicts with base class/trait#14535
JukkaL merged 2 commits intomasterfrom
native-int-attr-repr

Conversation

@JukkaL
Copy link
Copy Markdown
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
Copy Markdown
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