@@ -1764,6 +1764,15 @@ void CompletionLookup::addPrecedenceGroupRef(PrecedenceGroupDecl *PGD) {
1764
1764
builder.setAssociatedDecl (PGD);
1765
1765
}
1766
1766
1767
+ void CompletionLookup::addBuiltinMemberRef (StringRef Name,
1768
+ Type TypeAnnotation) {
1769
+ CodeCompletionResultBuilder Builder = makeResultBuilder (
1770
+ CodeCompletionResultKind::Pattern, SemanticContextKind::CurrentNominal);
1771
+ addLeadingDot (Builder);
1772
+ Builder.addBaseName (Name);
1773
+ addTypeAnnotation (Builder, TypeAnnotation);
1774
+ }
1775
+
1767
1776
void CompletionLookup::addEnumElementRef (const EnumElementDecl *EED,
1768
1777
DeclVisibilityKind Reason,
1769
1778
DynamicLookupInfo dynamicLookupInfo,
@@ -2276,20 +2285,17 @@ bool CompletionLookup::tryTupleExprCompletions(Type ExprType) {
2276
2285
2277
2286
unsigned Index = 0 ;
2278
2287
for (auto TupleElt : TT->getElements ()) {
2279
- CodeCompletionResultBuilder Builder = makeResultBuilder (
2280
- CodeCompletionResultKind::Pattern, SemanticContextKind::CurrentNominal);
2281
- addLeadingDot (Builder);
2288
+ auto Ty = TupleElt.getType ();
2282
2289
if (TupleElt.hasName ()) {
2283
- Builder. addBaseName (TupleElt.getName ().str ());
2290
+ addBuiltinMemberRef (TupleElt.getName ().str (), Ty );
2284
2291
} else {
2285
2292
llvm::SmallString<4 > IndexStr;
2286
2293
{
2287
2294
llvm::raw_svector_ostream OS (IndexStr);
2288
2295
OS << Index;
2289
2296
}
2290
- Builder. addBaseName (IndexStr. str () );
2297
+ addBuiltinMemberRef (IndexStr, Ty );
2291
2298
}
2292
- addTypeAnnotation (Builder, TupleElt.getType ());
2293
2299
++Index;
2294
2300
}
2295
2301
return true ;
0 commit comments