@@ -1184,11 +1184,8 @@ bool swift::diagnoseNonSendableTypesInReference(
1184
1184
// Check params of this function or subscript override for sendability
1185
1185
for (auto param : *paramList) {
1186
1186
Type paramType = param->getInterfaceType ().subst (subs);
1187
- if (param->isSending () && !paramType->hasError ()) {
1188
- continue ;
1189
- }
1190
- if (diagnoseNonSendableTypes (
1191
- paramType, fromDC, derivedConformanceType, refLoc,
1187
+ if (diagnoseNonSendableTypesWithSendingCheck (
1188
+ param, paramType, fromDC, derivedConformanceType, refLoc,
1192
1189
diagnoseLoc.isInvalid () ? refLoc : diagnoseLoc,
1193
1190
getSendableParamDiag (refKind), decl, getActorIsolation ()))
1194
1191
return true ;
@@ -1198,27 +1195,19 @@ bool swift::diagnoseNonSendableTypesInReference(
1198
1195
// Check the result type of a function or subscript.
1199
1196
if (funcCheckOptions.contains (FunctionCheckKind::Results)) {
1200
1197
Type resultType;
1201
- bool hasSendingResult;
1202
1198
if (auto func = dyn_cast<FuncDecl>(decl)) {
1203
1199
resultType = func->getResultInterfaceType ().subst (subs);
1204
- hasSendingResult = func->hasSendingResult ();
1205
1200
decl = func;
1206
1201
} else if (auto subscript = dyn_cast<SubscriptDecl>(decl)) {
1207
1202
resultType = subscript->getElementInterfaceType ().subst (subs);
1208
- hasSendingResult = isa<SendingTypeRepr>(subscript->getResultTypeRepr ());
1209
1203
}
1210
1204
if (!resultType) {
1211
1205
return false ;
1212
1206
}
1213
- auto diag = getSendableResultDiag (refKind);
1214
- if (diag.ID == diag::non_sendable_result_in_witness.ID &&
1215
- hasSendingResult && !resultType->hasError ()) {
1216
- return false ;
1217
- }
1218
- if (diagnoseNonSendableTypes (
1219
- resultType, fromDC, derivedConformanceType, refLoc,
1220
- diagnoseLoc.isInvalid () ? refLoc : diagnoseLoc, diag, decl,
1221
- getActorIsolation ()))
1207
+ if (diagnoseNonSendableTypesWithSendingCheck (
1208
+ decl, resultType, fromDC, derivedConformanceType, refLoc,
1209
+ diagnoseLoc.isInvalid () ? refLoc : diagnoseLoc,
1210
+ getSendableResultDiag (refKind), decl, getActorIsolation ()))
1222
1211
return true ;
1223
1212
}
1224
1213
0 commit comments