Revert "Revert "Merge pull request #27057 from theblixguy/unrevert/SR-11298""

This reverts commit 7725818275.
This commit is contained in:
Suyash Srijan
2019-10-12 00:01:34 +01:00
parent 7214b0da75
commit 70d77e9fe2
8 changed files with 91 additions and 24 deletions

View File

@@ -5628,10 +5628,16 @@ void VarDecl::emitLetToVarNoteIfSimple(DeclContext *UseDC) const {
if (FD && !FD->isMutating() && !FD->isImplicit() && FD->isInstanceMember()&&
!FD->getDeclContext()->getDeclaredInterfaceType()
->hasReferenceSemantics()) {
// Do not suggest the fix it in implicit getters
// Do not suggest the fix-it in implicit getters
if (auto AD = dyn_cast<AccessorDecl>(FD)) {
if (AD->isGetter() && !AD->getAccessorKeywordLoc().isValid())
return;
auto accessorDC = AD->getDeclContext();
// Do not suggest the fix-it if `Self` is a class type.
if (accessorDC->isTypeContext() && !accessorDC->hasValueSemantics()) {
return;
}
}
auto &d = getASTContext().Diags;