Merge pull request #7140 from rintaro/codecomplete-override-protocol

[CodeComplete] Don't emit 'override' in protocol extension
This commit is contained in:
Slava Pestov
2017-01-30 14:27:54 -08:00
committed by GitHub
2 changed files with 30 additions and 2 deletions

View File

@@ -4140,8 +4140,9 @@ public:
// FIXME: if we're missing 'override', but have the decl introducer we
// should delete it and re-add both in the correct order.
bool missingOverride = Reason == DeclVisibilityKind::MemberOfSuper &&
!hasOverride;
bool missingOverride =
!hasOverride && Reason == DeclVisibilityKind::MemberOfSuper &&
!CurrDeclContext->getAsProtocolOrProtocolExtensionContext();
if (!hasDeclIntroducer && missingOverride)
Builder.addOverrideKeyword();
@@ -4193,6 +4194,7 @@ public:
addAccessControl(CD, Builder);
if (!hasOverride && Reason == DeclVisibilityKind::MemberOfSuper &&
!CurrDeclContext->getAsProtocolOrProtocolExtensionContext() &&
CD->isDesignatedInit() && !CD->isRequired())
Builder.addOverrideKeyword();
@@ -4334,6 +4336,8 @@ public:
void getOverrideCompletions(SourceLoc Loc) {
if (!CurrDeclContext->getAsNominalTypeOrNominalTypeExtensionContext())
return;
if (isa<ProtocolDecl>(CurrDeclContext))
return;
Type CurrTy = CurrDeclContext->getDeclaredTypeInContext();
if (CurrTy && !CurrTy->is<ErrorType>()) {