mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Code completion: complete declarations that are required for declared protocol
conformances rdar://16539292 This is a hack in visible decl lookup. The general solution that would also improve type checker errors would be to make the type checker keep these broken conformances and syntethize missing declarations to make downstream code type check. For that, see: <rdar://problem/16723339> [QoI] Type checker should not be dropping protocol conformances explicitly spelled in the source Swift SVN r16818
This commit is contained in:
@@ -927,6 +927,7 @@ public:
|
||||
return SemanticContextKind::ExpressionSpecific;
|
||||
return SemanticContextKind::CurrentNominal;
|
||||
|
||||
case DeclVisibilityKind::MemberOfProtocolImplementedByCurrentNominal:
|
||||
case DeclVisibilityKind::MemberOfSuper:
|
||||
return SemanticContextKind::Super;
|
||||
|
||||
@@ -1774,7 +1775,7 @@ public:
|
||||
TypeResolver(createLazyResolver(Ctx)),
|
||||
CurrDeclContext(CurrDeclContext) {}
|
||||
|
||||
void addMethodOverride(const FuncDecl *FD) {
|
||||
void addMethodOverride(const FuncDecl *FD, DeclVisibilityKind Reason) {
|
||||
CodeCompletionResultBuilder Builder(
|
||||
Sink,
|
||||
CodeCompletionResult::ResultKind::Declaration,
|
||||
@@ -1784,7 +1785,8 @@ public:
|
||||
llvm::SmallString<256> DeclStr;
|
||||
{
|
||||
llvm::raw_svector_ostream OS(DeclStr);
|
||||
OS << "override ";
|
||||
if (Reason == DeclVisibilityKind::MemberOfSuper)
|
||||
OS << "override ";
|
||||
PrintOptions Options;
|
||||
Options.FunctionDefinitions = false;
|
||||
Options.PrintDefaultParameterPlaceholder = false;
|
||||
@@ -1813,7 +1815,7 @@ public:
|
||||
if (FD->isAccessor())
|
||||
return;
|
||||
|
||||
addMethodOverride(FD);
|
||||
addMethodOverride(FD, Reason);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user