@@ -1794,7 +1794,7 @@ class swift::MultiConformanceChecker {
17941794 llvm::SmallPtrSet<ValueDecl *, 8 > CoveredMembers;
17951795
17961796 // / Check one conformance.
1797- ProtocolConformance * checkIndividualConformance (
1797+ void checkIndividualConformance (
17981798 NormalProtocolConformance *conformance, bool issueFixit);
17991799
18001800 // / Determine whether the given requirement was left unsatisfied.
@@ -2051,36 +2051,21 @@ static bool hasAdditionalSemanticChecks(ProtocolDecl *proto) {
20512051
20522052// / Determine whether the type \c T conforms to the protocol \c Proto,
20532053// / recording the complete witness table if it does.
2054- ProtocolConformance * MultiConformanceChecker::
2054+ void MultiConformanceChecker::
20552055checkIndividualConformance (NormalProtocolConformance *conformance,
20562056 bool issueFixit) {
20572057 PrettyStackTraceConformance trace (" type-checking" , conformance);
20582058
2059- std::vector<ASTContext::MissingWitness> revivedMissingWitnesses;
20602059 switch (conformance->getState ()) {
20612060 case ProtocolConformanceState::Incomplete:
2062- if (conformance->isInvalid ()) {
2063- // Revive registered missing witnesses to handle it below.
2064- revivedMissingWitnesses = getASTContext ().takeDelayedMissingWitnesses (
2065- conformance);
2066-
2067- // If we have no missing witnesses for this invalid conformance, the
2068- // conformance is invalid for other reasons, so emit diagnosis now.
2069- if (revivedMissingWitnesses.empty ()) {
2070- // Emit any delayed diagnostics.
2071- ConformanceChecker (getASTContext (), conformance, MissingWitnesses)
2072- .emitDelayedDiags ();
2073- }
2074- }
2075-
20762061 // Check the rest of the conformance below.
20772062 break ;
20782063
20792064 case ProtocolConformanceState::CheckingTypeWitnesses:
20802065 case ProtocolConformanceState::Checking:
20812066 case ProtocolConformanceState::Complete:
20822067 // Nothing to do.
2083- return conformance ;
2068+ return ;
20842069 }
20852070
20862071 // Dig out some of the fields from the conformance.
@@ -2098,7 +2083,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
20982083 // If the protocol itself is invalid, there's nothing we can do.
20992084 if (Proto->isInvalid ()) {
21002085 conformance->setInvalid ();
2101- return conformance ;
2086+ return ;
21022087 }
21032088
21042089 // If the protocol requires a class, non-classes are a non-starter.
@@ -2107,7 +2092,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21072092 diag::non_class_cannot_conform_to_class_protocol, T,
21082093 ProtoType);
21092094 conformance->setInvalid ();
2110- return conformance ;
2095+ return ;
21112096 }
21122097
21132098 if (T->isActorType ()) {
@@ -2126,7 +2111,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21262111 actor->getDeclaredInterfaceType ());
21272112
21282113 conformance->setInvalid ();
2129- return conformance ;
2114+ return ;
21302115 }
21312116 }
21322117
@@ -2148,7 +2133,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21482133 if (diagKind) {
21492134 C.Diags .diagnose (ComplainLoc, diagKind.value (), T, ProtoType);
21502135 conformance->setInvalid ();
2151- return conformance ;
2136+ return ;
21522137 }
21532138 }
21542139
@@ -2162,7 +2147,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21622147 diag::objc_protocol_cannot_have_conditional_conformance,
21632148 T, ProtoType);
21642149 conformance->setInvalid ();
2165- return conformance ;
2150+ return ;
21662151 }
21672152 // And... even if it isn't conditional, we still don't currently support
21682153 // @objc protocols in extensions of Swift generic classes, because there's
@@ -2176,7 +2161,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21762161 diag::objc_protocol_in_generic_extension,
21772162 classDecl->isGeneric (), T, ProtoType);
21782163 conformance->setInvalid ();
2179- return conformance ;
2164+ return ;
21802165 }
21812166 }
21822167 }
@@ -2197,7 +2182,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
21972182 diag::objc_generics_cannot_conditionally_conform, T,
21982183 ProtoType);
21992184 conformance->setInvalid ();
2200- return conformance ;
2185+ return ;
22012186 }
22022187 }
22032188
@@ -2242,7 +2227,7 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
22422227 ProtoType);
22432228 }
22442229 conformance->setInvalid ();
2245- return conformance ;
2230+ return ;
22462231 }
22472232
22482233 // Complain about the use of @unchecked for protocols that don't have
@@ -2300,12 +2285,16 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
23002285 }
23012286
23022287 conformance->setInvalid ();
2303- return conformance ;
2288+ return ;
23042289 }
23052290 }
23062291
23072292 if (conformance->isComplete ())
2308- return conformance;
2293+ return ;
2294+
2295+ // Revive registered missing witnesses to handle it below.
2296+ auto revivedMissingWitnesses =
2297+ getASTContext ().takeDelayedMissingWitnesses (conformance);
23092298
23102299 // The conformance checker we're using.
23112300 AllUsedCheckers.emplace_back (getASTContext (), conformance, MissingWitnesses);
@@ -2316,7 +2305,6 @@ checkIndividualConformance(NormalProtocolConformance *conformance,
23162305 AllUsedCheckers.back ().checkConformance (
23172306 missingWitnessFixits ? MissingWitnessDiagnosisKind::ErrorFixIt
23182307 : MissingWitnessDiagnosisKind::ErrorOnly);
2319- return conformance;
23202308}
23212309
23222310// / Add the next associated type deduction to the string representation
0 commit comments