Skip to content

Commit

Permalink
[SourceKit] Expose ExpectedTypeRelation for the completion results
Browse files Browse the repository at this point in the history
So that clients can sort the results using this.

rdar://problem/59066560
  • Loading branch information
rintaro committed Feb 3, 2020
1 parent 7934cdf commit 1e74c39
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
key.description: "(arg1: Int, arg2: Int)",
key.typename: "Foo",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0,
key.associated_usrs: "s:20complete_constructor3FooC4arg14arg2ACSi_Sitcfc",
key.modulename: "complete_constructor"
Expand Down
2 changes: 2 additions & 0 deletions test/SourceKit/CodeComplete/complete_docbrief_1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func test() {
// CHECK-NEXT: key.typename: "Void",
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.bar",
// CHECK-NEXT: key.context: source.codecompletion.context.superclass,
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-NEXT: key.num_bytes_to_erase: 0,
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1PPAAE3baryyF",
// CHECK-NEXT: key.modulename: "DocBriefTest"
Expand All @@ -47,6 +48,7 @@ func test() {
// CHECK-NEXT: key.typename: "Void",
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-NEXT: key.num_bytes_to_erase: 0,
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
// CHECK-NEXT: key.modulename: "DocBriefTest"
Expand Down
1 change: 1 addition & 0 deletions test/SourceKit/CodeComplete/complete_docbrief_2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func test() {
// CHECK-NEXT: key.typename: "Void",
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-NEXT: key.num_bytes_to_erase: 0,
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefUser1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
// CHECK-NEXT: key.modulename: "DocBriefUser"
Expand Down
1 change: 1 addition & 0 deletions test/SourceKit/CodeComplete/complete_docbrief_3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func test() {
// CHECK-NEXT: key.typename: "Void",
// CHECK-NEXT: key.doc.brief: "This is a doc comment of P.foo",
// CHECK-NEXT: key.context: source.codecompletion.context.thisclass,
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-NEXT: key.num_bytes_to_erase: 0,
// CHECK-NEXT: key.associated_usrs: "s:12DocBriefTest1SV3fooyyF s:12DocBriefTest1PP3fooyyF",
// CHECK-NEXT: key.modulename: "DocBriefTest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foo
// CHECK-NEXT: key.typename: "Int32",
// CHECK-NEXT: key.doc.brief: "Aaa. fooIntVar. Bbb.",
// CHECK-NEXT: key.context: source.codecompletion.context.othermodule,
// CHECK-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-NEXT: key.num_bytes_to_erase: 0,
// CHECK-NEXT: key.associated_usrs: "c:@fooIntVar",
// CHECK-NEXT: key.modulename: "Foo"
Expand Down
2 changes: 2 additions & 0 deletions test/SourceKit/CodeComplete/complete_member.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func testOverrideUSR() {
// CHECK-OPTIONAL-NEXT: key.description: "fooInstanceFunc1(a: Int)",
// CHECK-OPTIONAL-NEXT: key.typename: "Double",
// CHECK-OPTIONAL-NEXT: key.context: source.codecompletion.context.thisclass,
// CHECK-OPTIONAL-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-OPTIONAL-NEXT: key.num_bytes_to_erase: 1,
// CHECK-OPTIONAL-NEXT: key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF",
// CHECK-OPTIONAL-NEXT: key.modulename: "complete_member"
Expand All @@ -72,6 +73,7 @@ func testOverrideUSR() {
// CHECK-OVERRIDE_USR-NEXT: key.description: "foo()",
// CHECK-OVERRIDE_USR-NEXT: key.typename: "Void",
// CHECK-OVERRIDE_USR-NEXT: key.context: source.codecompletion.context.thisclass,
// CHECK-OVERRIDE_USR-NEXT: key.typerelation: source.codecompletion.typerelation.unrelated,
// CHECK-OVERRIDE_USR-NEXT: key.num_bytes_to_erase: 0,
// CHECK-OVERRIDE_USR-NEXT: key.associated_usrs: "s:15complete_member7DerivedC3fooyyF s:15complete_member4BaseC3fooyyF",
// CHECK-OVERRIDE_USR-NEXT: key.modulename: "complete_member"
Expand Down
4 changes: 4 additions & 0 deletions test/SourceKit/CodeComplete/complete_member.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
key.description: "fooInstanceFunc0()",
key.typename: "Double",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0,
key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc0SdyF",
key.modulename: "complete_member"
Expand All @@ -18,6 +19,7 @@
key.description: "fooInstanceFunc1(a: Int)",
key.typename: "Double",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0,
key.associated_usrs: "s:15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF",
key.modulename: "complete_member"
Expand All @@ -30,6 +32,7 @@
key.typename: "Int",
key.doc.brief: "fooInstanceVar Aaa. Bbb.",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0,
key.associated_usrs: "s:15complete_member11FooProtocolP14fooInstanceVarSivp",
key.modulename: "complete_member"
Expand All @@ -41,6 +44,7 @@
key.description: "self",
key.typename: "FooProtocol",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
key.description: "optionalMethod?()",
key.typename: "Int",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0,
key.associated_usrs: "c:@M@complete_optionalmethod@objc(pl)Proto(im)optionalMethod",
key.modulename: "complete_optionalmethod"
Expand All @@ -18,6 +19,7 @@
key.description: "self",
key.typename: "T",
key.context: source.codecompletion.context.thisclass,
key.typerelation: source.codecompletion.typerelation.unrelated,
key.num_bytes_to_erase: 0
}
]
Expand Down
Loading

0 comments on commit 1e74c39

Please sign in to comment.