-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Deserialization] Don't add an OverrideAttr if the 'overridden' decl is a convenience init when deserializing #24212
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
[Deserialization] Don't add an OverrideAttr if the 'overridden' decl is a convenience init when deserializing #24212
Conversation
@swift-ci please test |
@@ -2646,7 +2646,8 @@ class swift::DeclDeserializer { | |||
if (auto *overridden = ctor->getOverriddenDecl()) { | |||
if (!attributeChainContains<RequiredAttr>(DAttrs) || | |||
!overridden->isRequired()) { | |||
AddAttribute(new (ctx) OverrideAttr(SourceLoc())); | |||
if (!overridden->isConvenienceInit()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave a comment behind saying that this doesn't really make sense? Either the convenience init is an override or it isn't. cc @DougGregor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure, will update shortly.
super.init(x: z) | ||
} | ||
// MERGE: {{^}} public convenience init() | ||
// SINGLE: {{^}} convenience public init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This switched order here is because we have a 'ConvenienceAttr` on the initializer when generating via the single invocation (which is printed when printing the decl's attributes) and don't after serializing/deserializing (where we print it based on the initializer kind).
… a convenience init when deserializing
a3c6759
to
2ae7315
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test OS X Platform |
@jrose-apple @harlanhaskins are you both ok with this now? |
The convenience initializer isn't really being overridden, and the attribute is only introduced after serializing and then de-serializing the AST. The attribute was causing us to incorrectly add the 'override' modifier on such initializers when printing the module interface as part of the merge-modules step. Trying to then consume them would give error: initializer does not override a designated initializer from its superclass.
Resolves rdar://problem/49856927