[Diagnostics] Add a diagnostic for inserting a $ to remove an extraneous property wrapper unwrap (#25507)

This commit is contained in:
Sam Lazarus
2019-06-20 20:28:25 -04:00
committed by GitHub
parent 38995f5d80
commit ebcbaca968
8 changed files with 164 additions and 5 deletions

View File

@@ -1975,6 +1975,14 @@ bool MissingCallFailure::diagnoseAsError() {
return true;
}
bool MissingPropertyWrapperUnwrapFailure::diagnoseAsError() {
emitDiagnostic(getAnchor()->getLoc(),
diag::extraneous_property_wrapper_unwrap, getPropertyName(),
getFromType(), getToType())
.fixItInsert(getAnchor()->getLoc(), "$");
return true;
}
bool SubscriptMisuseFailure::diagnoseAsError() {
auto &sourceMgr = getASTContext().SourceMgr;