[SR-14824] Improve diagnostic for multi-statement closures instead of saying "too complex closure return type"

This commit is contained in:
jiaren wang
2021-06-30 11:18:19 +08:00
parent 340c85503e
commit c5de1f0800
9 changed files with 17 additions and 18 deletions

View File

@@ -6845,8 +6845,7 @@ bool UnableToInferClosureParameterType::diagnoseAsError() {
bool UnableToInferClosureReturnType::diagnoseAsError() {
auto *closure = castToExpr<ClosureExpr>(getRawAnchor());
auto diagnostic = emitDiagnostic(diag::cannot_infer_closure_result_type,
closure->hasSingleExpressionBody());
auto diagnostic = emitDiagnostic(diag::cannot_infer_closure_result_type);
// If there is a location for an 'in' token, then the argument list was
// specified somehow but no return type was. Insert a "-> ReturnType "