Skip to content

Commit 0c38f2d

Browse files
committed
[CodeCompletion] Associate callee declaration with call patterns
In `addFunctionCallPattern()` we should associate declarations if possible. rdar://problem/49158044
1 parent b5610e7 commit 0c38f2d

13 files changed

+138
-80
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
16431643

16441644
void setExpectedTypes(ArrayRef<Type> Types, bool isSingleExpressionBody) {
16451645
expectedTypeContext.isSingleExpressionBody = isSingleExpressionBody;
1646+
expectedTypeContext.possibleTypes.clear();
16461647
expectedTypeContext.possibleTypes.reserve(Types.size());
16471648
for (auto T : Types)
16481649
if (T)
@@ -2238,22 +2239,56 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
22382239
Builder.addRightParen();
22392240
}
22402241

2242+
SemanticContextKind getSemanticContextKind(const AbstractFunctionDecl *AFD) {
2243+
// FIXME: to get the corect semantic context we need to know how lookup
2244+
// would have found the declaration AFD. For now, just infer a reasonable
2245+
// semantics.
2246+
2247+
if (!AFD)
2248+
return SemanticContextKind::CurrentModule;
2249+
2250+
DeclContext *calleeDC = AFD->getDeclContext();
2251+
2252+
if (calleeDC->isTypeContext())
2253+
// FIXME: We should distinguish CurrentNominal and Super. We need to
2254+
// propagate the base type to do that.
2255+
return SemanticContextKind::CurrentNominal;
2256+
2257+
if (calleeDC->isLocalContext())
2258+
return SemanticContextKind::Local;
2259+
if (calleeDC->getParentModule() == CurrDeclContext->getParentModule())
2260+
return SemanticContextKind::CurrentModule;
2261+
2262+
return SemanticContextKind::OtherModule;
2263+
}
2264+
22412265
void addFunctionCallPattern(const AnyFunctionType *AFT,
22422266
const AbstractFunctionDecl *AFD = nullptr) {
2267+
if (AFD) {
2268+
auto genericSig =
2269+
AFD->getInnermostDeclContext()->getGenericSignatureOfContext();
2270+
AFT = eraseArchetypes(CurrDeclContext->getParentModule(),
2271+
const_cast<AnyFunctionType *>(AFT), genericSig)
2272+
->castTo<AnyFunctionType>();
2273+
}
22432274

22442275
// Add the pattern, possibly including any default arguments.
22452276
auto addPattern = [&](ArrayRef<const ParamDecl *> declParams = {},
22462277
bool includeDefaultArgs = true) {
2247-
// FIXME: to get the corect semantic context we need to know how lookup
2248-
// would have found the declaration AFD. For now, just choose a reasonable
2249-
// default, it's most likely to be CurrentModule or CurrentNominal.
2278+
CommandWordsPairs Pairs;
22502279
CodeCompletionResultBuilder Builder(
2251-
Sink, CodeCompletionResult::ResultKind::Pattern,
2252-
SemanticContextKind::CurrentModule, expectedTypeContext);
2280+
Sink,
2281+
AFD ? CodeCompletionResult::ResultKind::Declaration
2282+
: CodeCompletionResult::ResultKind::Pattern,
2283+
getSemanticContextKind(AFD), expectedTypeContext);
22532284
if (!HaveLParen)
22542285
Builder.addLeftParen();
22552286
else
22562287
Builder.addAnnotatedLeftParen();
2288+
if (AFD) {
2289+
Builder.setAssociatedDecl(AFD);
2290+
setClangDeclKeywords(AFD, Pairs, Builder);
2291+
}
22572292

22582293
addCallArgumentPatterns(Builder, AFT->getParams(), declParams,
22592294
includeDefaultArgs);
@@ -5063,14 +5098,17 @@ void CodeCompletionCallbacksImpl::doneParsing() {
50635098
Lookup.setHaveLParen(true);
50645099

50655100
ExprContextInfo ContextInfo(CurDeclContext, CodeCompleteTokenExpr);
5066-
Lookup.setExpectedTypes(ContextInfo.getPossibleTypes(),
5067-
ContextInfo.isSingleExpressionBody());
5101+
50685102
if (ShouldCompleteCallPatternAfterParen) {
5069-
if (ExprType) {
5103+
ExprContextInfo ParentContextInfo(CurDeclContext, ParsedExpr);
5104+
Lookup.setExpectedTypes(ParentContextInfo.getPossibleTypes(),
5105+
ParentContextInfo.isSingleExpressionBody());
5106+
if (ExprType && ((*ExprType)->is<AnyFunctionType>() ||
5107+
(*ExprType)->is<AnyMetatypeType>())) {
50705108
Lookup.getValueExprCompletions(*ExprType, ReferencedDecl.getDecl());
50715109
} else {
50725110
for (auto &typeAndDecl : ContextInfo.getPossibleCallees())
5073-
Lookup.getValueExprCompletions(typeAndDecl.first, typeAndDecl.second);
5111+
Lookup.tryFunctionCallCompletions(typeAndDecl.first, typeAndDecl.second);
50745112
}
50755113
} else {
50765114
// Add argument labels, then fallthrough to get values.
@@ -5080,6 +5118,8 @@ void CodeCompletionCallbacksImpl::doneParsing() {
50805118
if (!Lookup.FoundFunctionCalls ||
50815119
(Lookup.FoundFunctionCalls &&
50825120
Lookup.FoundFunctionsWithoutFirstKeyword)) {
5121+
Lookup.setExpectedTypes(ContextInfo.getPossibleTypes(),
5122+
ContextInfo.isSingleExpressionBody());
50835123
Lookup.setHaveLParen(false);
50845124
DoPostfixExprBeginning();
50855125
}

lib/IDE/ExprContextAnalysis.cpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "swift/AST/Decl.h"
1717
#include "swift/AST/DeclContext.h"
1818
#include "swift/AST/Expr.h"
19+
#include "swift/AST/GenericSignature.h"
1920
#include "swift/AST/Initializer.h"
2021
#include "swift/AST/LazyResolver.h"
2122
#include "swift/AST/Module.h"
@@ -241,7 +242,7 @@ namespace {
241242
class ExprParentFinder : public ASTWalker {
242243
friend class ExprContextAnalyzer;
243244
Expr *ChildExpr;
244-
llvm::function_ref<bool(ParentTy, ParentTy)> Predicate;
245+
std::function<bool(ParentTy, ParentTy)> Predicate;
245246

246247
bool arePositionsSame(Expr *E1, Expr *E2) {
247248
return E1->getSourceRange().Start == E2->getSourceRange().Start &&
@@ -251,7 +252,7 @@ class ExprParentFinder : public ASTWalker {
251252
public:
252253
llvm::SmallVector<ParentTy, 5> Ancestors;
253254
ExprParentFinder(Expr *ChildExpr,
254-
llvm::function_ref<bool(ParentTy, ParentTy)> Predicate)
255+
std::function<bool(ParentTy, ParentTy)> Predicate)
255256
: ChildExpr(ChildExpr), Predicate(Predicate) {}
256257

257258
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
@@ -318,7 +319,8 @@ void collectPossibleCalleesByQualifiedLookup(
318319
SmallVector<ValueDecl *, 2> decls;
319320
auto resolver = DC.getASTContext().getLazyResolver();
320321
if (!DC.lookupQualified(baseTy->getMetatypeInstanceType(), name,
321-
NL_QualifiedDefault, resolver, decls))
322+
NL_QualifiedDefault | NL_ProtocolMembers, resolver,
323+
decls))
322324
return;
323325

324326
for (auto *VD : decls) {
@@ -350,8 +352,19 @@ void collectPossibleCalleesByQualifiedLookup(
350352

351353
if (!fnType)
352354
continue;
353-
if (auto *AFT = fnType->getAs<AnyFunctionType>()) {
354-
candidates.emplace_back(AFT, VD);
355+
356+
if (fnType->is<AnyFunctionType>()) {
357+
auto baseInstanceTy = baseTy->getMetatypeInstanceType();
358+
// If we are calling to typealias type,
359+
if (isa<SugarType>(baseInstanceTy.getPointer())) {
360+
auto canBaseTy = baseInstanceTy->getCanonicalType();
361+
fnType = fnType.transform([&](Type t) -> Type {
362+
if (t->getCanonicalType()->isEqual(canBaseTy))
363+
return baseInstanceTy;
364+
return t;
365+
});
366+
}
367+
candidates.emplace_back(fnType->castTo<AnyFunctionType>(), VD);
355368
}
356369
}
357370
}
@@ -741,15 +754,23 @@ class ExprContextAnalyzer {
741754
if (!ParsedExpr)
742755
return;
743756

744-
ExprParentFinder Finder(ParsedExpr, [](ASTWalker::ParentTy Node,
745-
ASTWalker::ParentTy Parent) {
757+
ExprParentFinder Finder(ParsedExpr, [&](ASTWalker::ParentTy Node,
758+
ASTWalker::ParentTy Parent) {
746759
if (auto E = Node.getAsExpr()) {
747760
switch (E->getKind()) {
748-
case ExprKind::Call:
761+
case ExprKind::Call: {
762+
// Iff the cursor is in argument position.
763+
auto argsRange = cast<CallExpr>(E)->getArg()->getSourceRange();
764+
return SM.rangeContains(argsRange, ParsedExpr->getSourceRange());
765+
}
766+
case ExprKind::Subscript: {
767+
// Iff the cursor is in index position.
768+
auto argsRange = cast<SubscriptExpr>(E)->getIndex()->getSourceRange();
769+
return SM.rangeContains(argsRange, ParsedExpr->getSourceRange());
770+
}
749771
case ExprKind::Binary:
750772
case ExprKind::PrefixUnary:
751773
case ExprKind::Assign:
752-
case ExprKind::Subscript:
753774
case ExprKind::Array:
754775
return true;
755776
case ExprKind::Tuple: {

test/IDE/complete_at_eof_in_call_1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Don't add any tests at the end of the file!
55
//
66
// A: Begin completions
7-
// A-DAG: Pattern/CurrModule: ['(']{#(x): Int#}[')'][#Void#]{{; name=.+$}}
7+
// A-DAG: Decl[FreeFunction]/CurrModule: ['(']{#(x): Int#}[')'][#Void#]{{; name=.+$}}
88
// A: End completions
99
func f(_ x: Int) {}
1010
f(#^A^#

test/IDE/complete_at_eof_in_call_no_newline_1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Don't add any tests at the end of the file!
55
//
66
// A: Begin completions
7-
// A-DAG: Pattern/CurrModule: ['(']{#(x): Int#}[')'][#Void#]{{; name=.+$}}
7+
// A-DAG: Decl[FreeFunction]/CurrModule: ['(']{#(x): Int#}[')'][#Void#]{{; name=.+$}}
88
// A: End completions
99
func f(_ x: Int) {}
1010
f(#^A^#

test/IDE/complete_call_arg.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class C3 {
246246

247247
func f6(obj: C3) {
248248
overloaded(#^OVERLOAD6^#
249+
func sync() {}
249250
obj.overloaded(#^OVERLOAD7^#
250251
}
251252
}
@@ -279,15 +280,15 @@ class C3 {
279280
// NEGATIVE_OVERLOAD4-NOT: Decl[Class]{{.*}} C2
280281

281282
// OVERLOAD5: Begin completions
282-
// OVERLOAD5-DAG: Pattern/CurrModule: ['(']{#(a): C1#}, {#b1: C2#}[')'][#Void#]; name=a: C1, b1: C2
283-
// OVERLOAD5-DAG: Pattern/CurrModule: ['(']{#(a): C2#}, {#b2: C1#}[')'][#Void#]; name=a: C2, b2: C1
283+
// OVERLOAD5-DAG: Decl[FreeFunction]/CurrModule: ['(']{#(a): C1#}, {#b1: C2#}[')'][#Void#]; name=a: C1, b1: C2
284+
// OVERLOAD5-DAG: Decl[FreeFunction]/CurrModule: ['(']{#(a): C2#}, {#b2: C1#}[')'][#Void#]; name=a: C2, b2: C1
284285
// OVERLOAD5-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: C1I[#C1#]; name=C1I
285286
// OVERLOAD5-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: C2I[#C2#]; name=C2I
286287
// OVERLOAD5: End completions
287288

288289
// OVERLOAD6: Begin completions
289-
// OVERLOAD6-DAG: Pattern/CurrModule: ['(']{#(a1): C1#}, {#b1: C2#}[')'][#Void#]; name=a1: C1, b1: C2
290-
// OVERLOAD6-DAG: Pattern/CurrModule: ['(']{#a2: C2#}, {#b2: C1#}[')'][#Void#]; name=a2: C2, b2: C1
290+
// OVERLOAD6-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#(a1): C1#}, {#b1: C2#}[')'][#Void#]; name=a1: C1, b1: C2
291+
// OVERLOAD6-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#a2: C2#}, {#b2: C1#}[')'][#Void#]; name=a2: C2, b2: C1
291292
// OVERLOAD6-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: C1I[#C1#]; name=C1I
292293
// OVERLOAD6-DAG: Decl[InstanceVar]/CurrNominal: C2I[#C2#]; name=C2I
293294
// OVERLOAD6: End completions
@@ -304,7 +305,7 @@ extension C3 {
304305
}
305306

306307
// HASERROR1: Begin completions
307-
// HASERROR1-DAG: Pattern/CurrModule: ['(']{#a1: C1#}, {#b1: <<error type>>#}[')'][#Int#];
308+
// HASERROR1-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#a1: C1#}, {#b1: <<error type>>#}[')'][#Int#];
308309
// HASERROR1: End completions
309310

310311
// HASERROR2: Begin completions
@@ -442,7 +443,7 @@ func testArg2Name3() {
442443
firstArg(#^FIRST_ARG_NAME_3^#,
443444
}
444445
// FIRST_ARG_NAME_3: Keyword/ExprSpecific: arg1: [#Argument name#]
445-
// FIRST_ARG_NAME_4: Pattern/CurrModule: ['(']{#arg1: Int#}, {#arg2: Int#}[')'][#Void#];
446+
// FIRST_ARG_NAME_4: Decl[FreeFunction]/CurrModule: ['(']{#arg1: Int#}, {#arg2: Int#}[')'][#Void#];
446447

447448
func takeArray<T>(_ x: [T]) {}
448449
struct TestBoundGeneric1 {
@@ -484,7 +485,7 @@ public func fopen() -> TestBoundGeneric1! { fatalError() }
484485
func other() {
485486
_ = fopen(#^CALLARG_IUO^#)
486487
// CALLARG_IUO: Begin completions, 1 items
487-
// CALLARG_IUO: Pattern/CurrModule: ['('][')'][#TestBoundGeneric1!#]; name=
488+
// CALLARG_IUO: Decl[FreeFunction]/CurrModule: ['('][')'][#TestBoundGeneric1!#]; name=
488489
// CALLARG_IUO: End completions
489490
}
490491

@@ -601,12 +602,14 @@ class TestImplicitlyCurriedSelf {
601602

602603
static func test() {
603604
foo(#^CURRIED_SELF_1^#
605+
func sync();
604606
self.foo(#^CURRIED_SELF_2^#
607+
func sync();
605608
TestImplicitlyCurriedSelf.foo(#^CURRIED_SELF_3^#
606609

607610
// CURRIED_SELF_1: Begin completions, 2 items
608-
// CURRIED_SELF_1-DAG: Pattern/CurrModule: ['(']{#(self): TestImplicitlyCurriedSelf#}[')'][#(Int) -> ()#]{{; name=.+$}}
609-
// CURRIED_SELF_1-DAG: Pattern/CurrModule: ['(']{#(self): TestImplicitlyCurriedSelf#}[')'][#(Int, Int) -> ()#]{{; name=.+$}}
611+
// CURRIED_SELF_1-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#(self): TestImplicitlyCurriedSelf#}[')'][#(Int) -> ()#]{{; name=.+$}}
612+
// CURRIED_SELF_1-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#(self): TestImplicitlyCurriedSelf#}[')'][#(Int, Int) -> ()#]{{; name=.+$}}
610613
// CURRIED_SELF_1: End completions
611614
}
612615
}

test/IDE/complete_constructor.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_4 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
4949

5050
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_1 | %FileCheck %s -check-prefix=AVAILABLE_1
51-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_2 | %FileCheck %s -check-prefix=AVAILABLE_2
51+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_2 | %FileCheck %s -check-prefix=AVAILABLE_1
5252

5353
func freeFunc() {}
5454

@@ -334,7 +334,7 @@ struct ClosureInInit1 {
334334
var prop1: S = {
335335
return S(#^CLOSURE_IN_INIT_1^#
336336
}
337-
// CLOSURE_IN_INIT_1: Decl[Constructor]/CurrNominal: ['(']{#Int#}[')'][#ClosureInInit1.S#];
337+
// CLOSURE_IN_INIT_1: Decl[Constructor]/CurrNominal{{(/TypeRelation\[Identical\])?}}: ['(']{#Int#}[')'][#ClosureInInit1.S#];
338338
var prop2: S = {
339339
return S(#^CLOSURE_IN_INIT_2^#
340340
}()
@@ -368,10 +368,4 @@ func testAvailable() {
368368
// AVAILABLE_1: End completions
369369

370370
let _ = AvailableTest.init(#^AVAILABLE_2^#
371-
// AVAILABLE_2: Begin completions, 3 items
372-
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#opt: Int#}[')'][#AvailableTest?#]; name=opt: Int
373-
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#normal1: Int#}[')'][#AvailableTest#]; name=normal1: Int
374-
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#normal2: Int#}[')'][#AvailableTest#]; name=normal2: Int
375-
// AVAILABLE_2: End completions
376-
377371
}

test/IDE/complete_default_arguments.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ func testDefaultArgs2() {
6767
freeFuncWithDefaultArgs1#^DEFAULT_ARGS_2^#
6868
}
6969
// DEFAULT_ARGS_2: Begin completions
70-
// DEFAULT_ARGS_2-DAG: Pattern/CurrModule: ({#(a): Int#})[#Void#]{{; name=.+$}}
71-
// DEFAULT_ARGS_2-DAG: Pattern/CurrModule: ({#(a): Int#}, {#b: Int#})[#Void#]{{; name=.+$}}
70+
// DEFAULT_ARGS_2-DAG: Decl[FreeFunction]/CurrModule: ({#(a): Int#})[#Void#]{{; name=.+$}}
71+
// DEFAULT_ARGS_2-DAG: Decl[FreeFunction]/CurrModule: ({#(a): Int#}, {#b: Int#})[#Void#]{{; name=.+$}}
7272
// DEFAULT_ARGS_2: End completions
7373

7474
func testDefaultArgs3() {
7575
freeFuncWithDefaultArgs3#^DEFAULT_ARGS_3^#
7676
}
7777
// DEFAULT_ARGS_3: Begin completions
78-
// DEFAULT_ARGS_3-DAG: Pattern/CurrModule: ()[#Void#]{{; name=.+$}}
79-
// DEFAULT_ARGS_3-DAG: Pattern/CurrModule: ({#a: Int#})[#Void#]{{; name=.+$}}
78+
// DEFAULT_ARGS_3-DAG: Decl[FreeFunction]/CurrModule: ()[#Void#]{{; name=.+$}}
79+
// DEFAULT_ARGS_3-DAG: Decl[FreeFunction]/CurrModule: ({#a: Int#})[#Void#]{{; name=.+$}}
8080
// DEFAULT_ARGS_3: End completions
8181

8282
func testDefaultArgs4(_ x: A) {
@@ -91,8 +91,8 @@ func testDefaultArgs5(_ x: A) {
9191
x.methodWithDefaultArgs1#^DEFAULT_ARGS_5^#
9292
}
9393
// DEFAULT_ARGS_5: Begin completions
94-
// DEFAULT_ARGS_5-DAG: Pattern/CurrModule: ()[#Void#]{{; name=.+$}}
95-
// DEFAULT_ARGS_5-DAG: Pattern/CurrModule: ({#a: Int#})[#Void#]{{; name=.+$}}
94+
// DEFAULT_ARGS_5-DAG: Decl[InstanceMethod]/CurrNominal: ()[#Void#]{{; name=.+$}}
95+
// DEFAULT_ARGS_5-DAG: Decl[InstanceMethod]/CurrNominal: ({#a: Int#})[#Void#]{{; name=.+$}}
9696
// DEFAULT_ARGS_5: End completions
9797

9898
func testDefaultArgs6() {

test/IDE/complete_dynamic_lookup.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ func testAnyObject11_(_ dl: AnyObject) {
463463
dl.returnsObjcClass!(#^DL_FUNC_NAME_PAREN_1^#
464464
}
465465
// DL_FUNC_NAME_PAREN_1: Begin completions
466-
// DL_FUNC_NAME_PAREN_1-DAG: Pattern/CurrModule: ['(']{#(i): Int#}[')'][#TopLevelObjcClass#]{{; name=.+$}}
466+
// DL_FUNC_NAME_PAREN_1-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#(i): Int#}[')'][#TopLevelObjcClass#]{{; name=.+$}}
467467
// DL_FUNC_NAME_PAREN_1: End completions
468468

469469
func testAnyObject12(_ dl: AnyObject) {
@@ -475,7 +475,7 @@ func testAnyObject13(_ dl: AnyObject) {
475475
dl.returnsObjcClass!#^DL_FUNC_NAME_BANG_1^#
476476
}
477477
// DL_FUNC_NAME_BANG_1: Begin completions
478-
// DL_FUNC_NAME_BANG_1-NEXT: Pattern/CurrModule: ({#(i): Int#})[#TopLevelObjcClass#]
478+
// DL_FUNC_NAME_BANG_1-NEXT: Decl[InstanceMethod]/CurrNominal: ({#(i): Int#})[#TopLevelObjcClass#]
479479
// DL_FUNC_NAME_BANG_1-NEXT: Keyword[self]/CurrNominal: .self[#(Int) -> TopLevelObjcClass#]; name=self
480480
// DL_FUNC_NAME_BANG_1-NEXT: End completions
481481

test/IDE/complete_from_clang_framework.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ func testCompleteModuleQualifiedBar1() {
227227
func testCompleteFunctionCall1() {
228228
fooFunc1#^FUNCTION_CALL_1^#
229229
// FUNCTION_CALL_1: Begin completions
230-
// FUNCTION_CALL_1-NEXT: Pattern/CurrModule: ({#(a): Int32#})[#Int32#]{{; name=.+$}}
230+
// FUNCTION_CALL_1-NEXT: Decl[FreeFunction]/OtherModule[Foo]: ({#(a): Int32#})[#Int32#]{{; name=.+$}}
231231
// FUNCTION_CALL_1-NEXT: Keyword[self]/CurrNominal: .self[#(Int32) -> Int32#]; name=self
232232
// FUNCTION_CALL_1-NEXT: End completions
233233
}
234234

235235
func testCompleteFunctionCall2() {
236236
fooFunc1AnonymousParam#^FUNCTION_CALL_2^#
237237
// FUNCTION_CALL_2: Begin completions
238-
// FUNCTION_CALL_2-NEXT: Pattern/CurrModule: ({#Int32#})[#Int32#]{{; name=.+$}}
238+
// FUNCTION_CALL_2-NEXT: Decl[FreeFunction]/OtherModule[Foo]: ({#Int32#})[#Int32#]{{; name=.+$}}
239239
// FUNCTION_CALL_2-NEXT: Keyword[self]/CurrNominal: .self[#(Int32) -> Int32#]; name=self
240240
// FUNCTION_CALL_2-NEXT: End completions
241241
}

test/IDE/complete_init_inherited.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class D : C {
7777

7878
// TEST_D_PAREN: Decl[Constructor]/CurrNominal: ['(']{#d: D#}[')'][#D#]; name=d: D
7979
// TEST_D_PAREN-NEXT: Decl[Constructor]/CurrNominal: ['(']{#int: Int#}[')'][#D#]; name=int: Int
80-
// TEST_D_PAREN-NEXT: Decl[Constructor]/Super: ['(']{#c: C#}[')'][#C#]; name=c: C
80+
// TEST_D_PAREN-NEXT: Decl[Constructor]/Super: ['(']{#c: C#}[')'][#C#]; name=c: C
8181

8282
func testA() {
8383
A#^TEST_A^#

0 commit comments

Comments
 (0)