@@ -1184,11 +1184,8 @@ bool swift::diagnoseNonSendableTypesInReference(
11841184 // Check params of this function or subscript override for sendability
11851185 for (auto param : *paramList) {
11861186 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,
11921189 diagnoseLoc.isInvalid () ? refLoc : diagnoseLoc,
11931190 getSendableParamDiag (refKind), decl, getActorIsolation ()))
11941191 return true ;
@@ -1198,27 +1195,19 @@ bool swift::diagnoseNonSendableTypesInReference(
11981195 // Check the result type of a function or subscript.
11991196 if (funcCheckOptions.contains (FunctionCheckKind::Results)) {
12001197 Type resultType;
1201- bool hasSendingResult;
12021198 if (auto func = dyn_cast<FuncDecl>(decl)) {
12031199 resultType = func->getResultInterfaceType ().subst (subs);
1204- hasSendingResult = func->hasSendingResult ();
12051200 decl = func;
12061201 } else if (auto subscript = dyn_cast<SubscriptDecl>(decl)) {
12071202 resultType = subscript->getElementInterfaceType ().subst (subs);
1208- hasSendingResult = isa<SendingTypeRepr>(subscript->getResultTypeRepr ());
12091203 }
12101204 if (!resultType) {
12111205 return false ;
12121206 }
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 ()))
12221211 return true ;
12231212 }
12241213
0 commit comments