@@ -4848,18 +4848,6 @@ void TypeChecker::checkConformancesInContext(DeclContext *dc,
4848
4848
// If there were any unsatisfied requirements, check whether there
4849
4849
// are any near-matches we should diagnose.
4850
4850
if (!unsatisfiedReqs.empty () && !anyInvalid) {
4851
- // Collect the set of witnesses that came from this context.
4852
- llvm::SmallPtrSet<ValueDecl *, 16 > knownWitnesses;
4853
- for (auto conformance : conformances) {
4854
- conformance->forEachValueWitness (
4855
- nullptr ,
4856
- [&](ValueDecl *req, ConcreteDeclRef witness) {
4857
- // If there is a witness, record it if it's within this context.
4858
- if (witness.getDecl () && witness.getDecl ()->getDeclContext () == dc)
4859
- knownWitnesses.insert (witness.getDecl ());
4860
- });
4861
- }
4862
-
4863
4851
// Find all of the members that aren't used to satisfy
4864
4852
// requirements, and check whether they are close to an
4865
4853
// unsatisfied or defaulted requirement.
@@ -4869,9 +4857,17 @@ void TypeChecker::checkConformancesInContext(DeclContext *dc,
4869
4857
auto value = dyn_cast<ValueDecl>(member);
4870
4858
if (!value) continue ;
4871
4859
if (isa<TypeDecl>(value)) continue ;
4872
- if (knownWitnesses.count (value) > 0 ) continue ;
4873
4860
if (!value->getFullName ()) continue ;
4874
4861
4862
+ // If this declaration overrides another declaration, the signature is
4863
+ // fixed; don't complain about near misses.
4864
+ if (value->getOverriddenDecl ()) continue ;
4865
+
4866
+ // If this member is a witness to any @objc requirement, ignore it.
4867
+ if (!findWitnessedObjCRequirements (value, /* anySingleRequirement=*/ true )
4868
+ .empty ())
4869
+ continue ;
4870
+
4875
4871
// Find the unsatisfied requirements with the nearest-matching
4876
4872
// names.
4877
4873
SmallVector<ValueDecl *, 4 > bestOptionalReqs;
0 commit comments