@@ -5579,9 +5579,11 @@ bool ConstraintSystem::repairFailures(
5579
5579
}
5580
5580
5581
5581
if (auto *VD = getAsDecl<ValueDecl>(anchor)) {
5582
- // Matching a witness to a ObjC protocol requirement.
5583
- if (VD->isObjC() && VD->isProtocolRequirement() &&
5584
- path[0].is<LocatorPathElt::Witness>() &&
5582
+ // Matching a witness to an ObjC protocol requirement.
5583
+ if (VD->isObjC() &&
5584
+ isa<ProtocolDecl>(VD->getDeclContext()) &&
5585
+ VD->isProtocolRequirement() &&
5586
+ path[0].is<LocatorPathElt::Witness>() &&
5585
5587
// Note that the condition below is very important,
5586
5588
// we need to wait until the very last moment to strip
5587
5589
// the concurrency annotations from the inner most type.
@@ -5593,10 +5595,11 @@ bool ConstraintSystem::repairFailures(
5593
5595
if (!(Context.isSwiftVersionAtLeast(6) ||
5594
5596
Context.LangOpts.StrictConcurrencyLevel ==
5595
5597
StrictConcurrency::Complete)) {
5596
- auto strippedLHS = lhs->stripConcurrency(/*resursive =*/true,
5598
+ auto strippedLHS = lhs->stripConcurrency(/*recursive =*/true,
5597
5599
/*dropGlobalActor=*/true);
5598
- auto strippedRHS = rhs->stripConcurrency(/*resursive =*/true,
5600
+ auto strippedRHS = rhs->stripConcurrency(/*recursive =*/true,
5599
5601
/*dropGlobalActor=*/true);
5602
+
5600
5603
auto result = matchTypes(strippedLHS, strippedRHS, matchKind,
5601
5604
flags | TMF_ApplyingFix, locator);
5602
5605
if (!result.isFailure()) {
0 commit comments