@@ -2022,6 +2022,11 @@ class MultiConformanceChecker {
2022
2022
AllConformances.push_back (conformance);
2023
2023
}
2024
2024
2025
+ // / Get the conformances associated with this checker.
2026
+ ArrayRef<NormalProtocolConformance *> getConformances () const {
2027
+ return AllConformances;
2028
+ }
2029
+
2025
2030
// / Peek the unsatisfied requirements collected during conformance checking.
2026
2031
ArrayRef<ValueDecl*> getUnsatisfiedRequirements () {
2027
2032
return llvm::ArrayRef (UnsatisfiedReqs);
@@ -2085,6 +2090,10 @@ static void diagnoseProtocolStubFixit(
2085
2090
ArrayRef<ASTContext::MissingWitness> missingWitnesses);
2086
2091
2087
2092
void MultiConformanceChecker::checkAllConformances () {
2093
+ if (AllConformances.empty ()) {
2094
+ return ;
2095
+ }
2096
+
2088
2097
llvm::SmallVector<ASTContext::MissingWitness, 2 > MissingWitnesses;
2089
2098
2090
2099
bool anyInvalid = false ;
@@ -6248,7 +6257,6 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
6248
6257
ProtocolConformance *SendableConformance = nullptr ;
6249
6258
bool hasDeprecatedUnsafeSendable = false ;
6250
6259
bool sendableConformancePreconcurrency = false ;
6251
- bool anyInvalid = false ;
6252
6260
for (auto conformance : conformances) {
6253
6261
// Check and record normal conformances.
6254
6262
if (auto normal = dyn_cast<NormalProtocolConformance>(conformance)) {
@@ -6382,12 +6390,6 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
6382
6390
}
6383
6391
}
6384
6392
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
-
6391
6393
// Diagnose any conflicts attributed to this declaration context.
6392
6394
for (const auto &diag : idc->takeConformanceDiagnostics ()) {
6393
6395
// Figure out the declaration of the existing conformance.
@@ -6519,9 +6521,19 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
6519
6521
diag.ExistingExplicitProtocol ->getName ());
6520
6522
}
6521
6523
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
+
6522
6534
// If there were any unsatisfied requirements, check whether there
6523
6535
// are any near-matches we should diagnose.
6524
- if (!unsatisfiedReqs.empty () && !anyInvalid ) {
6536
+ if (!unsatisfiedReqs.empty ()) {
6525
6537
if (sf->Kind != SourceFileKind::Interface) {
6526
6538
// Find all of the members that aren't used to satisfy
6527
6539
// requirements, and check whether they are close to an
0 commit comments