[CodeCompletion] Make Void-returning functions "NotRecommended" in typed context

When we know we're expecting an expression that returns a value, make
the completion "NotRecommended" to deprioritize it.

rdar://problem/22810741
This commit is contained in:
Ben Langmuir
2016-03-29 14:18:56 -07:00
parent 12593eff13
commit 968b0491b8
12 changed files with 105 additions and 65 deletions

View File

@@ -899,6 +899,9 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
typeRelation =
calculateMaxTypeRelationForDecl(AssociatedDecl, ExpectedDeclTypes);
if (typeRelation == CodeCompletionResult::Invalid)
IsNotRecommended = true;
return new (*Sink.Allocator) CodeCompletionResult(
SemanticContext, NumBytesToErase, CCS, AssociatedDecl, ModuleName,
/*NotRecommended=*/IsNotRecommended,