Skip to content

Commit 5118086

Browse files
committed
Check only when diagnosting non_sendable_result_in_witness
1 parent 044716d commit 5118086

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,12 @@ bool swift::diagnoseNonSendableTypesInReference(
11951195
// only check results if funcCheckKind specifies so
11961196
Type resultType = func->getResultInterfaceType().subst(subs);
11971197

1198-
if (func->hasSendingResult() && !resultType->hasError())
1199-
return true;
1198+
auto diag = getSendableResultDiag(refKind);
1199+
1200+
if (diag.ID == diag::non_sendable_result_in_witness.ID &&
1201+
func->hasSendingResult() && !resultType->hasError()) {
1202+
return false;
1203+
}
12001204

12011205
if (diagnoseNonSendableTypes(
12021206
resultType, fromDC, derivedConformanceType,

0 commit comments

Comments
 (0)