Skip to content

Commit 0c9da0f

Browse files
committed
Sema: Use diagnoseOrDefer() in ConformanceChecker::ensureRequirementsAreSatisfied()
1 parent 2973e3f commit 0c9da0f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5110,20 +5110,19 @@ void ConformanceChecker::ensureRequirementsAreSatisfied() {
51105110
// Diagnose the failure generically.
51115111
// FIXME: Would be nice to give some more context here!
51125112
if (!Conformance->isInvalid()) {
5113-
diags.diagnose(Loc, diag::type_does_not_conform,
5114-
Adoptee,
5115-
Proto->getDeclaredInterfaceType());
5116-
51175113
if (result.getKind() == CheckRequirementsResult::RequirementFailure) {
5118-
TypeChecker::diagnoseRequirementFailure(
5119-
result.getRequirementFailureInfo(), Loc, Loc,
5120-
proto->getDeclaredInterfaceType(),
5121-
{proto->getSelfInterfaceType()->castTo<GenericTypeParamType>()},
5122-
QuerySubstitutionMap{substitutions}, module);
5114+
auto Loc = this->Loc;
5115+
diagnoseOrDefer(nullptr, /*isError=*/true,
5116+
[Loc, result, proto, substitutions, module](NormalProtocolConformance *conformance) {
5117+
TypeChecker::diagnoseRequirementFailure(
5118+
result.getRequirementFailureInfo(), Loc, Loc,
5119+
proto->getDeclaredInterfaceType(),
5120+
{proto->getSelfInterfaceType()->castTo<GenericTypeParamType>()},
5121+
QuerySubstitutionMap{substitutions}, module);
5122+
});
51235123
}
51245124

51255125
Conformance->setInvalid();
5126-
AlreadyComplained = true;
51275126
}
51285127
return;
51295128
}

0 commit comments

Comments
 (0)