Skip to content

Commit aac4e85

Browse files
committed
[AST] WitnessMatching: Bring back original check for missing Sendable conformances
1 parent 0cc26cf commit aac4e85

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,20 +1237,13 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
12371237
}
12381238
bool requiresNonSendable = false;
12391239
if (!solution || solution->Fixes.size()) {
1240-
auto isMatchedAllowed = [&](const constraints::Solution &solution) {
1241-
/// If the *only* problems are that `@Sendable` attributes are missing,
1242-
/// allow the match in some circumstances.
1243-
if (llvm::all_of(solution.Fixes, [](constraints::ConstraintFix *fix) {
1244-
return fix->getKind() ==
1245-
constraints::FixKind::AddSendableAttribute;
1246-
}))
1247-
return true;
1248-
1249-
// In all other cases - disallow the match.
1250-
return false;
1251-
};
1252-
1253-
if (!solution || !isMatchedAllowed(*solution))
1240+
/// If the *only* problems are that `@Sendable` attributes are missing,
1241+
/// allow the match in some circumstances.
1242+
requiresNonSendable = solution
1243+
&& llvm::all_of(solution->Fixes, [](constraints::ConstraintFix *fix) {
1244+
return fix->getKind() == constraints::FixKind::AddSendableAttribute;
1245+
});
1246+
if (!requiresNonSendable)
12541247
return RequirementMatch(witness, MatchKind::TypeConflict,
12551248
witnessType);
12561249
}

0 commit comments

Comments
 (0)