mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix synthesis of 'override' and 'required' on initializers (#20548)
This is actually two separate problems: - 'override' wasn't getting added to initializers in deserialization - 'override' was getting added when inheriting a 'required' initializer, even though it's normally an error to write that Needed for parseable interfaces.
This commit is contained in:
@@ -2473,11 +2473,12 @@ configureInheritedDesignatedInitAttributes(TypeChecker &tc,
|
||||
}
|
||||
|
||||
// Wire up the overrides.
|
||||
ctor->getAttrs().add(new (ctx) OverrideAttr(/*IsImplicit=*/true));
|
||||
ctor->setOverriddenDecl(superclassCtor);
|
||||
|
||||
if (superclassCtor->isRequired())
|
||||
ctor->getAttrs().add(new (ctx) RequiredAttr(/*IsImplicit=*/true));
|
||||
ctor->getAttrs().add(new (ctx) RequiredAttr(/*IsImplicit=*/false));
|
||||
else
|
||||
ctor->getAttrs().add(new (ctx) OverrideAttr(/*IsImplicit=*/false));
|
||||
|
||||
// If the superclass constructor is @objc but the subclass constructor is
|
||||
// not representable in Objective-C, add @nonobjc implicitly.
|
||||
|
||||
Reference in New Issue
Block a user