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