mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[api-digester] Teach the api-digester about hasMissingDesignatedInitializers
Because we won’t be serializing this attribute, add custom diagnostics for the cases where: - We add @_hasMissingDesignatedInits to an open class, which means subclasses won’t be able to inherit its inits - We remove @_inheritsConvenienceInitializers, which means APIs are removed
This commit is contained in:
committed by
Robert Widmann
parent
511db0c90a
commit
4d731735d2
@@ -789,6 +789,22 @@ void swift::ide::api::SDKNodeDeclType::diagnose(SDKNode *Right) {
|
||||
emitDiag(Loc, diag::super_class_changed, LSuperClass, RSuperClass);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for @_hasMissingDesignatedInitializers and
|
||||
// @_inheritsConvenienceInitializers changes.
|
||||
if (isOpen() && R->isOpen()) {
|
||||
// It's not safe to add new, invisible designated inits to open
|
||||
// classes.
|
||||
if (!hasMissingDesignatedInitializers() &&
|
||||
R->hasMissingDesignatedInitializers())
|
||||
R->emitDiag(R->getLoc(), diag::added_invisible_designated_init);
|
||||
}
|
||||
|
||||
// It's not safe to stop inheriting convenience inits, it changes
|
||||
// the set of initializers that are available.
|
||||
if (inheritsConvenienceInitializers() &&
|
||||
!R->inheritsConvenienceInitializers())
|
||||
R->emitDiag(R->getLoc(), diag::not_inheriting_convenience_inits);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user