Merge pull request #74564 from gottesmm/pr-9be87019f95149167c2e03043b7a86b82f9d282c

Follow up fixes with feedback from #74129
This commit is contained in:
Michael Gottesman
2024-06-25 10:24:26 -07:00
committed by GitHub
5 changed files with 38 additions and 66 deletions

View File

@@ -7919,21 +7919,25 @@ bool NonEphemeralConversionFailure::diagnoseAsError() {
return true;
}
bool SendingOnFunctionParameterMismatchFail::diagnoseAsError() {
emitDiagnosticAt(getLoc(), diag::sending_function_wrong_sending,
getFromType(), getToType())
bool SendingMismatchFailure::diagnoseAsError() {
if (getLocator()->getLastElementAs<LocatorPathElt::FunctionArgument>())
return diagnoseArgFailure();
return diagnoseResultFailure();
}
bool SendingMismatchFailure::diagnoseArgFailure() {
emitDiagnostic(diag::sending_function_wrong_sending, getFromType(),
getToType())
.warnUntilSwiftVersion(6);
emitDiagnosticAt(getLoc(),
diag::sending_function_param_with_sending_param_note);
emitDiagnostic(diag::sending_function_param_with_sending_param_note);
return true;
}
bool SendingOnFunctionResultMismatchFailure::diagnoseAsError() {
emitDiagnosticAt(getLoc(), diag::sending_function_wrong_sending,
getFromType(), getToType())
bool SendingMismatchFailure::diagnoseResultFailure() {
emitDiagnostic(diag::sending_function_wrong_sending, getFromType(),
getToType())
.warnUntilSwiftVersion(6);
emitDiagnosticAt(getLoc(),
diag::sending_function_result_with_sending_param_note);
emitDiagnostic(diag::sending_function_result_with_sending_param_note);
return true;
}