mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ABI checker: adding protocol requirement with default implementation should not be flagged as breakage
rdar://98583968
This commit is contained in:
@@ -691,6 +691,21 @@ public:
|
||||
// to the allowlist.
|
||||
ShouldComplain = false;
|
||||
}
|
||||
if (ShouldComplain) {
|
||||
// Providing a default implementation via a protocol extension for
|
||||
// a protocol requirement is both ABI and API safe.
|
||||
if (auto *PD = dyn_cast<SDKNodeDecl>(D->getParent())) {
|
||||
for (auto *SIB: PD->getChildren()) {
|
||||
if (auto *SIBD = dyn_cast<SDKNodeDecl>(SIB)) {
|
||||
if (SIBD->isFromExtension() &&
|
||||
SIBD->getPrintedName() == D->getPrintedName()) {
|
||||
ShouldComplain = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ShouldComplain)
|
||||
D->emitDiag(D->getLoc(), diag::protocol_req_added);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user