[Diagnostics] Always use the parameter name for closure parameter diagnostics,

because the $ prefix does not indicate that the parameter is anonymous.
This commit is contained in:
Holly Borla
2021-05-11 18:30:27 -07:00
parent ef58f6a827
commit c297070106
7 changed files with 8 additions and 18 deletions

View File

@@ -6770,13 +6770,9 @@ bool UnableToInferClosureParameterType::diagnoseAsError() {
llvm::SmallString<16> id;
llvm::raw_svector_ostream OS(id);
if (PD->isAnonClosureParam()) {
OS << "$" << paramIdx;
} else {
OS << "'" << PD->getParameterName() << "'";
}
OS << "'" << PD->getParameterName() << "'";
auto loc = PD->isAnonClosureParam() ? getLoc() : PD->getLoc();
auto loc = PD->isImplicit() ? getLoc() : PD->getLoc();
emitDiagnosticAt(loc, diag::cannot_infer_closure_parameter_type, OS.str());
return true;
}