Skip to content

Commit 0c193e2

Browse files
committed
Check only when diagnosting non_sendable_result_in_witness
1 parent fbf5524 commit 0c193e2

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
@@ -1203,8 +1203,12 @@ bool swift::diagnoseNonSendableTypesInReference(
12031203
// only check results if funcCheckKind specifies so
12041204
Type resultType = func->getResultInterfaceType().subst(subs);
12051205

1206-
if (func->hasSendingResult() && !resultType->hasError())
1207-
return true;
1206+
auto diag = getSendableResultDiag(refKind);
1207+
1208+
if (diag.ID == diag::non_sendable_result_in_witness.ID &&
1209+
func->hasSendingResult() && !resultType->hasError()) {
1210+
return false;
1211+
}
12081212

12091213
if (diagnoseNonSendableTypes(
12101214
resultType, fromDC, derivedConformanceType,

0 commit comments

Comments
 (0)