Skip to content

Commit f247c49

Browse files
committed
Merge pull request swiftlang#1167 from tkremenek/Swift2.2-SourceKit-CallParameterInternalName
[Swift-2.2] [SourceKit] Omit internal parameters from filter name
2 parents 3b3f475 + c19b9fa commit f247c49

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

test/SourceKit/CodeComplete/complete_filter.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,20 @@ func test() {
106106
// GROUP-NEXT: ]
107107
// GROUP-LABEL: Results for filterText: overloadp [
108108
// GROUP-NEXT: ]
109+
110+
struct UnnamedArgs {
111+
func dontMatchAgainst(unnamed: Int, arguments: Int, _ unnamed2:Int) {}
112+
func test() {
113+
self.#^UNNAMED_ARGS_0,dont,arguments,unnamed^#
114+
}
115+
}
116+
117+
// RUN: %complete-test -tok=UNNAMED_ARGS_0 %s | FileCheck %s -check-prefix=UNNAMED_ARGS_0
118+
// UNNAMED_ARGS_0: Results for filterText: dont [
119+
// UNNAMED_ARGS_0-NEXT: dontMatchAgainst(unnamed: Int, arguments: Int, unnamed2: Int)
120+
// UNNAMED_ARGS_0-NEXT: ]
121+
// UNNAMED_ARGS_0-NEXT: Results for filterText: arguments [
122+
// UNNAMED_ARGS_0-NEXT: dontMatchAgainst(unnamed: Int, arguments: Int, unnamed2: Int)
123+
// UNNAMED_ARGS_0-NEXT: ]
124+
// UNNAMED_ARGS_0-NEXT: Results for filterText: unnamed [
125+
// UNNAMED_ARGS_0-NEXT: ]

test/SourceKit/CodeComplete/complete_member.swift.response

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
key.kind: source.lang.swift.decl.function.method.instance,
16-
key.name: "fooInstanceFunc1(a:)",
16+
key.name: "fooInstanceFunc1(:)",
1717
key.sourcetext: "fooInstanceFunc1(<#T##a: Int##Int#>)",
1818
key.description: "fooInstanceFunc1(a: Int)",
1919
key.typename: "Double",

test/SourceKit/CodeComplete/complete_moduleimportdepth.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func test() {
99
// RUN: FileCheck %s < %t
1010

1111
// Swift == 1
12-
// CHECK-LABEL: key.name: "abs(x:)",
12+
// CHECK-LABEL: key.name: "abs(:)",
1313
// CHECK-NEXT: key.sourcetext: "abs(<#T##x: T##T#>)",
1414
// CHECK-NEXT: key.description: "abs(x: T)",
1515
// CHECK-NEXT: key.typename: "T",
@@ -22,7 +22,7 @@ func test() {
2222
// CHECK-NEXT: },
2323

2424
// FooHelper.FooHelperExplicit == 1
25-
// CHECK-LABEL: key.name: "fooHelperExplicitFrameworkFunc1(a:)",
25+
// CHECK-LABEL: key.name: "fooHelperExplicitFrameworkFunc1(:)",
2626
// CHECK-NEXT: key.sourcetext: "fooHelperExplicitFrameworkFunc1(<#T##a: Int32##Int32#>)",
2727
// CHECK-NEXT: key.description: "fooHelperExplicitFrameworkFunc1(a: Int32)",
2828
// CHECK-NEXT: key.typename: "Int32",

test/SourceKit/CodeComplete/complete_name.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
// RUN: %complete-test -raw -tok=METHOD_NAME %s | FileCheck %s -check-prefix=METHOD_NAME
33

44
struct S {
5-
init(a: Int, b: Int) {}
6-
func foo(a: Int, b: Int) {}
5+
init(a: Int, b: Int, _ c: Int) {}
6+
init(_ a: Int, _ b: Int) {}
7+
func foo1(a: Int, _ b: Int, _ c: Int) {}
8+
func foo2(a a: Int, b: Int, c: Int) {}
79
}
810

911
func test01() {
1012
S(#^INIT_NAME^#)
1113
}
12-
// INIT_NAME: key.name: "a:b:)"
14+
// INIT_NAME: key.name: "a:b::)"
1315

1416
func test02(x: S) {
1517
x.#^METHOD_NAME^#
1618
}
17-
// METHOD_NAME: key.name: "foo(a:b:)"
19+
// METHOD_NAME: key.name: "foo1(:::)"
20+
// METHOD_NAME: key.name: "foo2(a:b:c:)"

test/SourceKit/CodeComplete/complete_with_closure_param.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ C().
99
// RUN: %sourcekitd-test -req=complete -pos=7:5 %s -- %s | FileCheck %s
1010

1111
// CHECK: key.kind: source.lang.swift.decl.function.method.instance,
12-
// CHECK-NEXT: key.name: "foo(x:)",
12+
// CHECK-NEXT: key.name: "foo(:)",
1313
// CHECK-NEXT: key.sourcetext: "foo(<#T##x: Int -> Int##Int -> Int#>)",
1414
// CHECK-NEXT: key.description: "foo(x: Int -> Int)",
1515
// CHECK-NEXT: key.typename: "Void",
1616

1717
// CHECK: key.kind: source.lang.swift.decl.function.method.instance,
18-
// CHECK-NEXT: key.name: "foo2(x:)",
18+
// CHECK-NEXT: key.name: "foo2(:)",
1919
// CHECK-NEXT: key.sourcetext: "foo2(<#T##x: MyFnTy##MyFnTy##Int -> Int#>)",
2020
// CHECK-NEXT: key.description: "foo2(x: MyFnTy)",

tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ void CompletionBuilder::getFilterName(CodeCompletionString *str,
873873
bool shouldPrint = !C.isAnnotation();
874874
switch (C.getKind()) {
875875
case ChunkKind::TypeAnnotation:
876+
case ChunkKind::CallParameterInternalName:
876877
case ChunkKind::CallParameterClosureType:
877878
case ChunkKind::CallParameterType:
878879
case ChunkKind::DeclAttrParamEqual:

0 commit comments

Comments
 (0)