@@ -3711,20 +3711,20 @@ filterProtocolRequirements(
3711
3711
// / Sometimes a witness isn't really diagnosed as missing if we have two
3712
3712
// / complementary Objective-C protocol requirements, only one of which must
3713
3713
// / be witnessed.
3714
- static bool shouldRecordMissingWitness (
3715
- ProtocolDecl *proto,
3716
- NormalProtocolConformance *conformance,
3717
- ValueDecl *requirement) {
3714
+ static bool
3715
+ hasSatisfiedObjCSiblingRequirement ( ProtocolDecl *proto,
3716
+ NormalProtocolConformance *conformance,
3717
+ ValueDecl *requirement) {
3718
3718
assert (proto == requirement->getDeclContext ());
3719
3719
assert (proto == conformance->getProtocol ());
3720
3720
3721
3721
// We only care about functions.
3722
3722
auto fnRequirement = dyn_cast<AbstractFunctionDecl>(requirement);
3723
3723
if (fnRequirement == nullptr )
3724
- return true ;
3724
+ return false ;
3725
3725
3726
3726
if (!proto->isObjC ())
3727
- return true ;
3727
+ return false ;
3728
3728
3729
3729
auto map = getObjCRequirementMap (proto);
3730
3730
@@ -3751,10 +3751,10 @@ static bool shouldRecordMissingWitness(
3751
3751
// record a missing witness.
3752
3752
return static_cast <bool >(conformance->getWitness (candidate));
3753
3753
})) {
3754
- return false ;
3754
+ return true ;
3755
3755
}
3756
3756
3757
- return true ;
3757
+ return false ;
3758
3758
}
3759
3759
3760
3760
static void diagnoseProtocolStubFixit (
@@ -4645,7 +4645,7 @@ bool ConformanceChecker::allowOptionalWitness(ValueDecl *requirement) {
4645
4645
4646
4646
// A requirement with a satisfied Obj-C alternative requirement is effectively
4647
4647
// optional.
4648
- if (! shouldRecordMissingWitness (Proto, Conformance, requirement))
4648
+ if (hasSatisfiedObjCSiblingRequirement (Proto, Conformance, requirement))
4649
4649
return true ;
4650
4650
4651
4651
return false ;
0 commit comments