[Sema] Allow associated type inference to skip @Sendable on ObjC witnesses

Witness checking itself is allowed to skip `@Sendable` mismatch in this
situation. This is a narrow fix for `SendableCompletionHandlers` feature
to make sure that the behavior doesn't change for non-ObjC witnesses
This commit is contained in:
Pavel Yaskevich
2025-02-25 22:19:33 -08:00
parent ffbbfb76bc
commit 3032add0ad
4 changed files with 51 additions and 1 deletions

View File

@@ -375,7 +375,8 @@ private:
if (firstFunc->isNoEscape() != secondFunc->isNoEscape())
return mismatch(firstFunc.getPointer(), secondFunc, sugaredFirstType);
if (firstFunc->isSendable() != secondFunc->isSendable())
if (!Matcher.asDerived().allowSendableFunctionMismatch() &&
firstFunc->isSendable() != secondFunc->isSendable())
return mismatch(firstFunc.getPointer(), secondFunc, sugaredFirstType);
auto sugaredFirstFunc = sugaredFirstType->castTo<AnyFunctionType>();
@@ -554,6 +555,8 @@ private:
bool alwaysMismatchTypeParameters() const { return false; }
bool allowSendableFunctionMismatch() const { return false; }
void pushPosition(Position pos) {}
void popPosition(Position pos) {}