swift-module-digester: added protocol requirements can be source-breaking.

This commit is contained in:
Xi Ge
2018-09-23 08:48:05 -07:00
parent a64ae05454
commit 4e3f8f4784
8 changed files with 93 additions and 0 deletions

View File

@@ -813,6 +813,20 @@ public:
}
}
}
// Complain about added protocol requirements
if (auto *D = dyn_cast<SDKNodeDecl>(Right)) {
if (D->isProtocolRequirement()) {
bool ShouldComplain = true;
// We should allow added associated types with default.
if (auto ATD = dyn_cast<SDKNodeDeclAssociatedType>(D)) {
if (ATD->getDefault())
ShouldComplain = false;
}
if (ShouldComplain)
Ctx.getDiags().diagnose(SourceLoc(), diag::protocol_req_added,
D->getScreenInfo());
}
}
return;
case NodeMatchReason::Removed:
assert(!Right);