@@ -2022,6 +2022,11 @@ class MultiConformanceChecker {
20222022 AllConformances.push_back (conformance);
20232023 }
20242024
2025+ // / Get the conformances associated with this checker.
2026+ ArrayRef<NormalProtocolConformance *> getConformances () const {
2027+ return AllConformances;
2028+ }
2029+
20252030 // / Peek the unsatisfied requirements collected during conformance checking.
20262031 ArrayRef<ValueDecl*> getUnsatisfiedRequirements () {
20272032 return llvm::ArrayRef (UnsatisfiedReqs);
@@ -2085,6 +2090,10 @@ static void diagnoseProtocolStubFixit(
20852090 ArrayRef<ASTContext::MissingWitness> missingWitnesses);
20862091
20872092void MultiConformanceChecker::checkAllConformances () {
2093+ if (AllConformances.empty ()) {
2094+ return ;
2095+ }
2096+
20882097 llvm::SmallVector<ASTContext::MissingWitness, 2 > MissingWitnesses;
20892098
20902099 bool anyInvalid = false ;
@@ -6248,7 +6257,6 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
62486257 ProtocolConformance *SendableConformance = nullptr ;
62496258 bool hasDeprecatedUnsafeSendable = false ;
62506259 bool sendableConformancePreconcurrency = false ;
6251- bool anyInvalid = false ;
62526260 for (auto conformance : conformances) {
62536261 // Check and record normal conformances.
62546262 if (auto normal = dyn_cast<NormalProtocolConformance>(conformance)) {
@@ -6382,12 +6390,6 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
63826390 }
63836391 }
63846392
6385- // Catalog all of members of this declaration context that satisfy
6386- // requirements of conformances in this context.
6387- SmallVector<ValueDecl *, 16 >
6388- unsatisfiedReqs (groupChecker.getUnsatisfiedRequirements ().begin (),
6389- groupChecker.getUnsatisfiedRequirements ().end ());
6390-
63916393 // Diagnose any conflicts attributed to this declaration context.
63926394 for (const auto &diag : idc->takeConformanceDiagnostics ()) {
63936395 // Figure out the declaration of the existing conformance.
@@ -6519,9 +6521,19 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
65196521 diag.ExistingExplicitProtocol ->getName ());
65206522 }
65216523
6524+ if (groupChecker.getConformances ().empty ()) {
6525+ return ;
6526+ }
6527+
6528+ // Catalog all of members of this declaration context that satisfy
6529+ // requirements of conformances in this context.
6530+ SmallVector<ValueDecl *, 16 > unsatisfiedReqs (
6531+ groupChecker.getUnsatisfiedRequirements ().begin (),
6532+ groupChecker.getUnsatisfiedRequirements ().end ());
6533+
65226534 // If there were any unsatisfied requirements, check whether there
65236535 // are any near-matches we should diagnose.
6524- if (!unsatisfiedReqs.empty () && !anyInvalid ) {
6536+ if (!unsatisfiedReqs.empty ()) {
65256537 if (sf->Kind != SourceFileKind::Interface) {
65266538 // Find all of the members that aren't used to satisfy
65276539 // requirements, and check whether they are close to an
0 commit comments