@@ -3991,6 +3991,8 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
3991
3991
auto protocolSubMap = SubstitutionMap::getProtocolSubstitutions (
3992
3992
proto, selfType.getDependentType (*this ), ProtocolConformanceRef (proto));
3993
3993
3994
+ auto result = ConstraintResult::Resolved;
3995
+
3994
3996
// Use the requirement signature to avoid rewalking the entire protocol. This
3995
3997
// cannot compute the requirement signature directly, because that may be
3996
3998
// infinitely recursive: this code is also used to construct it.
@@ -4007,19 +4009,20 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
4007
4009
auto reqResult = substReq
4008
4010
? addRequirement (*substReq, innerSource, nullptr )
4009
4011
: ConstraintResult::Conflicting;
4010
- if (isErrorResult (reqResult)) return reqResult;
4012
+ if (isErrorResult (reqResult) && !isErrorResult (result))
4013
+ result = reqResult;
4011
4014
}
4012
4015
4013
- return ConstraintResult::Resolved ;
4016
+ return result ;
4014
4017
}
4015
4018
4016
4019
if (!onlySameTypeConstraints) {
4017
4020
// Add all of the inherited protocol requirements, recursively.
4018
4021
auto inheritedReqResult =
4019
4022
addInheritedRequirements (proto, selfType.getUnresolvedType (), source,
4020
4023
nullptr );
4021
- if (isErrorResult (inheritedReqResult))
4022
- return inheritedReqResult;
4024
+ if (isErrorResult (inheritedReqResult) && ! isErrorResult (inheritedReqResult) )
4025
+ result = inheritedReqResult;
4023
4026
}
4024
4027
4025
4028
// Add any requirements in the where clause on the protocol.
@@ -4048,7 +4051,7 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
4048
4051
getASTContext ()),
4049
4052
innerSource);
4050
4053
4051
- return ConstraintResult::Resolved ;
4054
+ return result ;
4052
4055
}
4053
4056
4054
4057
// Remaining logic is not relevant in ObjC protocol cases.
@@ -4159,8 +4162,8 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
4159
4162
auto assocResult =
4160
4163
addInheritedRequirements (assocTypeDecl, assocType, source,
4161
4164
/* inferForModule=*/ nullptr );
4162
- if (isErrorResult (assocResult))
4163
- return assocResult;
4165
+ if (isErrorResult (assocResult) && ! isErrorResult (result) )
4166
+ result = assocResult;
4164
4167
}
4165
4168
4166
4169
// Add requirements from this associated type's where clause.
@@ -4314,7 +4317,7 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
4314
4317
}
4315
4318
}
4316
4319
4317
- return ConstraintResult::Resolved ;
4320
+ return result ;
4318
4321
}
4319
4322
4320
4323
ConstraintResult GenericSignatureBuilder::addConformanceRequirement (
0 commit comments