Skip to content

Commit fb9b043

Browse files
committed
[IDE] Pass AssociatedDecl to CodeCompletionResult on creation
1 parent b216fe1 commit fb9b043

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

lib/IDE/CodeCompletionResultBuilder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
171171
// If the sink only intends to store the context free results in the cache,
172172
// we don't need to compute any contextual properties.
173173
return new (Allocator) CodeCompletionResult(
174-
*ContextFreeResult, SemanticContextKind::None, CodeCompletionFlair(),
175-
/*NumBytesToErase=*/0, CodeCompletionResultTypeRelation::Unrelated,
174+
*ContextFreeResult, AssociatedDecl, /*HasValidAssociatedDecl=*/true,
175+
SemanticContextKind::None, CodeCompletionFlair(), /*NumBytesToErase=*/0,
176+
CodeCompletionResultTypeRelation::Unrelated,
176177
ContextualNotRecommendedReason::None);
177178
} else {
178179
assert(
@@ -191,8 +192,9 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
191192
ContextualNotRecReason, CanCurrDeclContextHandleAsync);
192193

193194
return new (Allocator) CodeCompletionResult(
194-
*ContextFreeResult, SemanticContext, Flair, NumBytesToErase,
195-
typeRelation, notRecommendedReason);
195+
*ContextFreeResult, AssociatedDecl, /*HasValidAssociatedDecl=*/true,
196+
SemanticContext, Flair, NumBytesToErase, typeRelation,
197+
notRecommendedReason);
196198
}
197199
}
198200

tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ bool SourceKit::CodeCompletion::addCustomCompletions(
140140
ContextFreeNotRecommendedReason::None,
141141
CodeCompletionDiagnosticSeverity::None, /*DiagnosticMessage=*/"");
142142
auto *swiftResult = new (sink.allocator) CodeCompletion::SwiftResult(
143-
*contextFreeResult, SemanticContextKind::Local,
144-
CodeCompletionFlairBit::ExpressionSpecific,
145-
/*NumBytesToErase=*/0, CodeCompletionResultTypeRelation::Unrelated,
143+
*contextFreeResult, /*AssociatedDecl=*/nullptr,
144+
/*HasValidAssociatedDecl=*/true, SemanticContextKind::Local,
145+
CodeCompletionFlairBit::ExpressionSpecific, /*NumBytesToErase=*/0,
146+
CodeCompletionResultTypeRelation::Unrelated,
146147
ContextualNotRecommendedReason::None);
147148

148149
CompletionBuilder builder(sink, *swiftResult);

tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,8 @@ static void transformAndForwardResults(
916916
CodeCompletionDiagnosticSeverity::None,
917917
/*DiagnosticMessage=*/"");
918918
auto *paren = new (innerSink.allocator) CodeCompletion::SwiftResult(
919-
*contextFreeResult, SemanticContextKind::CurrentNominal,
919+
*contextFreeResult, /*AssociatedDecl=*/nullptr,
920+
/*HasValidAssociatedDecl=*/true, SemanticContextKind::CurrentNominal,
920921
CodeCompletionFlairBit::ExpressionSpecific,
921922
exactMatch ? exactMatch->getNumBytesToErase() : 0,
922923
CodeCompletionResultTypeRelation::Unrelated,

0 commit comments

Comments
 (0)