Skip to content

Commit 1e74c39

Browse files
committed
[SourceKit] Expose ExpectedTypeRelation for the completion results
So that clients can sort the results using this. rdar://problem/59066560
1 parent 7934cdf commit 1e74c39

16 files changed

+88
-0
lines changed

test/SourceKit/CodeComplete/complete_constructor.swift.response

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
key.description: "(arg1: Int, arg2: Int)",
88
key.typename: "Foo",
99
key.context: source.codecompletion.context.thisclass,
10+
key.typerelation: source.codecompletion.typerelation.unrelated,
1011
key.num_bytes_to_erase: 0,
1112
key.associated_usrs: "s:20complete_constructor3FooC4arg14arg2ACSi_Sitcfc",
1213
key.modulename: "complete_constructor"

test/SourceKit/CodeComplete/complete_docbrief_1.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func test() {
3535
// CHECK-NEXT: key.typename: "Void",
3636
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.bar",
3737
// CHECK-NEXT: key.context: source.codecompletion.context.superclass,
38+
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
3839
// CHECK-NEXT: key.num_bytes_to_erase: 0,
3940
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1PPAAE3baryyF",
4041
// CHECK-NEXT: key.modulename: "DocBriefTest"
@@ -47,6 +48,7 @@ func test() {
4748
// CHECK-NEXT: key.typename: "Void",
4849
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
4950
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
51+
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
5052
// CHECK-NEXT: key.num_bytes_to_erase: 0,
5153
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
5254
// CHECK-NEXT: key.modulename: "DocBriefTest"

test/SourceKit/CodeComplete/complete_docbrief_2.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func test() {
3939
// CHECK-NEXT: key.typename: "Void",
4040
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
4141
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
42+
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
4243
// CHECK-NEXT: key.num_bytes_to_erase: 0,
4344
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefUser1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
4445
// CHECK-NEXT: key.modulename: "DocBriefUser"

test/SourceKit/CodeComplete/complete_docbrief_3.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func test() {
4040
// CHECK-NEXT: key.typename: "Void",
4141
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
4242
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
43+
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
4344
// CHECK-NEXT: key.num_bytes_to_erase: 0,
4445
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
4546
// CHECK-NEXT: key.modulename: "DocBriefTest"

test/SourceKit/CodeComplete/complete_from_clang_module.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Foo
99
// CHECK-NEXT: key.typename: "Int32",
1010
// CHECK-NEXT: key.doc.brief: "Aaa. fooIntVar. Bbb.",
1111
// CHECK-NEXT: key.context: source.codecompletion.context.othermodule,
12+
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
1213
// CHECK-NEXT: key.num_bytes_to_erase: 0,
1314
// CHECK-NEXT: key.associated_usrs: "c:@fooIntVar",
1415
// CHECK-NEXT: key.modulename: "Foo"

test/SourceKit/CodeComplete/complete_member.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func testOverrideUSR() {
5151
// CHECK-OPTIONAL-NEXT: key.description: "fooInstanceFunc1(a: Int)",
5252
// CHECK-OPTIONAL-NEXT: key.typename: "Double",
5353
// CHECK-OPTIONAL-NEXT: key.context: source.codecompletion.context.thisclass,
54+
// CHECK-OPTIONAL-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
5455
// CHECK-OPTIONAL-NEXT: key.num_bytes_to_erase: 1,
5556
// CHECK-OPTIONAL-NEXT: key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF",
5657
// CHECK-OPTIONAL-NEXT: key.modulename: "complete_member"
@@ -72,6 +73,7 @@ func testOverrideUSR() {
7273
// CHECK-OVERRIDE_USR-NEXT: key.description: "foo()",
7374
// CHECK-OVERRIDE_USR-NEXT: key.typename: "Void",
7475
// CHECK-OVERRIDE_USR-NEXT: key.context: source.codecompletion.context.thisclass,
76+
// CHECK-OVERRIDE_USR-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
7577
// CHECK-OVERRIDE_USR-NEXT: key.num_bytes_to_erase: 0,
7678
// CHECK-OVERRIDE_USR-NEXT: key.associated_usrs: "s:15complete_member7DerivedC3fooyyF s:15complete_member4BaseC3fooyyF",
7779
// CHECK-OVERRIDE_USR-NEXT: key.modulename: "complete_member"

test/SourceKit/CodeComplete/complete_member.swift.response

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
key.description: "fooInstanceFunc0()",
88
key.typename: "Double",
99
key.context: source.codecompletion.context.thisclass,
10+
key.typerelation: source.codecompletion.typerelation.unrelated,
1011
key.num_bytes_to_erase: 0,
1112
key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc0SdyF",
1213
key.modulename: "complete_member"
@@ -18,6 +19,7 @@
1819
key.description: "fooInstanceFunc1(a: Int)",
1920
key.typename: "Double",
2021
key.context: source.codecompletion.context.thisclass,
22+
key.typerelation: source.codecompletion.typerelation.unrelated,
2123
key.num_bytes_to_erase: 0,
2224
key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF",
2325
key.modulename: "complete_member"
@@ -30,6 +32,7 @@
3032
key.typename: "Int",
3133
key.doc.brief: "fooInstanceVar Aaa. Bbb.",
3234
key.context: source.codecompletion.context.thisclass,
35+
key.typerelation: source.codecompletion.typerelation.unrelated,
3336
key.num_bytes_to_erase: 0,
3437
key.associated_usrs: "s:15complete_member11FooProtocolP14fooInstanceVarSivp",
3538
key.modulename: "complete_member"
@@ -41,6 +44,7 @@
4144
key.description: "self",
4245
key.typename: "FooProtocol",
4346
key.context: source.codecompletion.context.thisclass,
47+
key.typerelation: source.codecompletion.typerelation.unrelated,
4448
key.num_bytes_to_erase: 0
4549
}
4650
]

test/SourceKit/CodeComplete/complete_optionalmethod.swift.response

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
key.description: "optionalMethod?()",
88
key.typename: "Int",
99
key.context: source.codecompletion.context.thisclass,
10+
key.typerelation: source.codecompletion.typerelation.unrelated,
1011
key.num_bytes_to_erase: 0,
1112
key.associated_usrs: "c:@M@complete_optionalmethod@objc(pl)Proto(im)optionalMethod",
1213
key.modulename: "complete_optionalmethod"
@@ -18,6 +19,7 @@
1819
key.description: "self",
1920
key.typename: "T",
2021
key.context: source.codecompletion.context.thisclass,
22+
key.typerelation: source.codecompletion.typerelation.unrelated,
2123
key.num_bytes_to_erase: 0
2224
}
2325
]

0 commit comments

Comments
 (0)