Skip to content

Commit db33dfa

Browse files
committed
[IDE] Offer unresolved member completions with non-matching types
Since the user can now write additional member accesses off of an UnresolvedMemberExpr, we should offer all available completions rather than just those that match the contextual type.
1 parent 968112e commit db33dfa

12 files changed

+115
-39
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4284,14 +4284,18 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
42844284
if (!T->mayHaveMembers())
42854285
return;
42864286

4287-
DeclContext *DC = const_cast<DeclContext *>(CurrDeclContext);
4288-
42894287
// We can only say .foo where foo is a static member of the contextual
42904288
// type and has the same type (or if the member is a function, then the
42914289
// same result type) as the contextual type.
42924290
FilteredDeclConsumer consumer(*this, [=](ValueDecl *VD,
42934291
DeclVisibilityKind Reason) {
4294-
return isReferenceableByImplicitMemberExpr(CurrModule, DC, T, VD);
4292+
if (T->getOptionalObjectType() &&
4293+
VD->getModuleContext()->isStdlibModule()) {
4294+
// In optional context, ignore '.init(<some>)', 'init(nilLiteral:)',
4295+
if (isa<ConstructorDecl>(VD))
4296+
return false;
4297+
}
4298+
return true;
42954299
});
42964300

42974301
auto baseType = MetatypeType::get(T);

test/IDE/complete_annotation.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ func testPostfix(value: MyStruct) {
9595
func testImplicitMember() -> MyStruct {
9696
return .#^EXPR_IMPLICITMEMBER^#
9797
}
98-
// EXPR_IMPLICITMEMBER: Begin completions, 3 items
98+
// EXPR_IMPLICITMEMBER: Begin completions, 7 items
9999
// EXPR_IMPLICITMEMBER-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: <name>init</name>(<callarg><callarg.label>x</callarg.label>: <callarg.type><typeid.sys>Int</typeid.sys></callarg.type></callarg>); typename=<typeid.user>MyStruct</typeid.user>;
100100
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: <name>instance</name>; typename=<typeid.user>MyStruct</typeid.user>;
101+
// EXPR_IMPLICITMEMBER-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: <name>labelNameParamName</name>(<callarg><callarg.label>_</callarg.label> <callarg.param>self</callarg.param>: <callarg.type><typeid.user>MyStruct</typeid.user></callarg.type></callarg>); typename=(label: (<keyword>inout</keyword> <typeid.sys>Int</typeid.sys>) <keyword>throws</keyword> -&gt; <typeid.user>MyStruct</typeid.user>) -&gt; <typeid.sys>Void</typeid.sys>;
102+
// EXPR_IMPLICITMEMBER-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: <name>labelName</name>(<callarg><callarg.label>_</callarg.label> <callarg.param>self</callarg.param>: <callarg.type><typeid.user>MyStruct</typeid.user></callarg.type></callarg>); typename=(label: (<attribute>@autoclosure</attribute> () -&gt; <typeid.sys>Int</typeid.sys>) -&gt; <typeid.sys>Int</typeid.sys>) -&gt; <typeid.sys>Void</typeid.sys>;
103+
// EXPR_IMPLICITMEMBER-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: <name>sameName</name>(<callarg><callarg.label>_</callarg.label> <callarg.param>self</callarg.param>: <callarg.type><typeid.user>MyStruct</typeid.user></callarg.type></callarg>); typename=(label: <keyword>inout</keyword> <typeid.sys>Int</typeid.sys>) -&gt; <typeid.sys>Void</typeid.sys>;
104+
// EXPR_IMPLICITMEMBER-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: <name>paramName</name>(<callarg><callarg.label>_</callarg.label> <callarg.param>self</callarg.param>: <callarg.type><typeid.user>MyStruct</typeid.user></callarg.type></callarg>); typename=(<typeid.sys>Int</typeid.sys>) -&gt; <typeid.sys>Void</typeid.sys>;
101105
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticMethod]/ExprSpecific/TypeRelation[Identical]: <name>create</name>(<callarg><callarg.label>x</callarg.label>: <callarg.type><typeid.sys>Int</typeid.sys></callarg.type></callarg>); typename=<typeid.user>MyStruct</typeid.user>;
102106
// EXPR_IMPLICITMEMBER: End completions
103107

test/IDE/complete_assignment.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,19 @@ func f2() {
127127
d = .#^ASSIGN_5^#
128128
}
129129

130-
// ASSIGN_5: Begin completions, 2 items
130+
// ASSIGN_5: Begin completions, 3 items
131131
// ASSIGN_5-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: case2[#D1#]; name=case2
132132
// ASSIGN_5-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: case1[#D1#]; name=case1
133+
// ASSIGN_5-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): D1#})[#(into: inout Hasher) -> Void#]; name=hash(self: D1)
133134

134135
func f6() {
135136
var d : D2
136137
d = .#^ASSIGN_6^#
137138
}
138-
// ASSIGN_6: Begin completions, 2 items
139+
// ASSIGN_6: Begin completions, 3 items
139140
// ASSIGN_6-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: case3[#D2#]; name=case3
140141
// ASSIGN_6-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: case4[#D2#]; name=case4
142+
// ASSIGN_6-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): D2#})[#(into: inout Hasher) -> Void#]; name=hash(self: D2)
141143

142144
func f7 (C : C2) {
143145
var i : Int

test/IDE/complete_call_arg.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,12 @@ func testTupleShuffle() {
579579
// SHUFFLE_2-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: s1[#String#]; name=s1
580580
// SHUFFLE_2-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: s2[#String#]; name=s2
581581

582-
// SHUFFLE_3: Begin completions, 3 items
582+
// SHUFFLE_3: Begin completions, 4 items
583583
// SHUFFLE_3-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: foo[#SimpleEnum#]; name=foo
584584
// SHUFFLE_3-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: bar[#SimpleEnum#]; name=bar
585585
// SHUFFLE_3-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: baz[#SimpleEnum#]; name=baz
586+
// SHUFFLE_3-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): SimpleEnum#})[#(into: inout Hasher) -> Void#]; name=hash(self: SimpleEnum)
587+
586588

587589
class HasSubscript {
588590
subscript(idx: Int) -> String {}
@@ -833,10 +835,11 @@ func testPamrameterFlags(_: Int, inoutArg: inout Int, autoclosureArg: @autoclosu
833835

834836
func testTupleElement(arg: (SimpleEnum, SimpleEnum)) {
835837
testTupleElement(arg: (.foo, .#^TUPLEELEM_1^#))
836-
// TUPLEELEM_1: Begin completions, 3 items
838+
// TUPLEELEM_1: Begin completions, 4 items
837839
// TUPLEELEM_1-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: foo[#SimpleEnum#]; name=foo
838840
// TUPLEELEM_1-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: bar[#SimpleEnum#]; name=bar
839841
// TUPLEELEM_1-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: baz[#SimpleEnum#]; name=baz
842+
// TUPLEELEM_1-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): SimpleEnum#})[#(into: inout Hasher) -> Void#]; name=hash(self: SimpleEnum)
840843
// TUPLEELEM_1: End completions
841844
testTupleElement(arg: (.foo, .bar, .#^TUPLEELEM_2^#))
842845
// TUPLEELEM_2-NOT: Begin completions
@@ -852,10 +855,11 @@ func testKeyPathThunkInBase() {
852855
func foo(_ fn: (TestKP) -> Int) -> TestKPResult { TestKPResult() }
853856

854857
foo(\.value).testFunc(.#^KEYPATH_THUNK_BASE^#)
855-
// KEYPATH_THUNK_BASE: Begin completions, 3 items
858+
// KEYPATH_THUNK_BASE: Begin completions, 4 items
856859
// KEYPATH_THUNK_BASE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: foo[#SimpleEnum#]; name=foo
857860
// KEYPATH_THUNK_BASE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: bar[#SimpleEnum#]; name=bar
858861
// KEYPATH_THUNK_BASE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: baz[#SimpleEnum#]; name=baz
862+
// KEYPATH_THUNK_BASE-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): SimpleEnum#})[#(into: inout Hasher) -> Void#]; name=hash(self: SimpleEnum)
859863
// KEYPATH_THUNK_BASE: End completions
860864
}
861865

test/IDE/complete_call_as_function.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ func testCallAsFunctionOverloaded(fn: Functor) {
111111

112112
fn(h: .left, v: .#^OVERLOADED_ARG2_VALUE^#)
113113
// FIXME: Should only suggest 'up' and 'down' (rdar://problem/60346573).
114-
//OVERLOADED_ARG2_VALUE: Begin completions, 4 items
114+
//OVERLOADED_ARG2_VALUE: Begin completions, 6 items
115115
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: up[#Functor.Vertical#];
116116
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: down[#Functor.Vertical#];
117+
//OVERLOADED_ARG2_VALUE-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): Functor.Vertical#})[#(into: inout Hasher) -> Void#];
117118
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: left[#Functor.Horizontal#];
118119
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: right[#Functor.Horizontal#];
120+
//OVERLOADED_ARG2_VALUE-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): Functor.Horizontal#})[#(into: inout Hasher) -> Void#];
119121
//OVERLOADED_ARG2_VALUE: End completions
120122
}

test/IDE/complete_constrained.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ struct Vegetarian: EatsFruit, EatsVegetables { }
117117

118118
func testVegetarian(chef: Chef<Vegetarian>) {
119119
chef.cook(.#^CONDITIONAL_OVERLOAD_ARG^#)
120-
// CONDITIONAL_OVERLOAD_ARG: Begin completions, 2 items
120+
// CONDITIONAL_OVERLOAD_ARG: Begin completions, 4 items
121121
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: apple[#Fruit#]; name=apple
122+
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): Fruit#})[#(into: inout Hasher) -> Void#]; name=hash(self: Fruit)
122123
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: broccoli[#Vegetable#]; name=broccoli
124+
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): Vegetable#})[#(into: inout Hasher) -> Void#]; name=hash(self: Vegetable)
123125
// CONDITIONAL_OVERLOAD_ARG: End completions
124126

125127
var chefMeta: Chef<Vegetarian>.Type = Chef<Vegetarian>.self

test/IDE/complete_enum_elements.swift

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,18 @@ enum FooEnum: CaseIterable {
138138
// FOO_ENUM_DOT_INVALID-NEXT: Decl[StaticVar]/CurrNominal: allCases[#[FooEnum]#]{{; name=.+$}}
139139
// FOO_ENUM_DOT_INVALID-NEXT: End completions
140140

141-
// FOO_ENUM_DOT_ELEMENTS: Begin completions, 3 items
141+
// FOO_ENUM_DOT_ELEMENTS: Begin completions, 11 items
142142
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Foo1[#FooEnum#]{{; name=.+$}}
143143
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Foo2[#FooEnum#]{{; name=.+$}}
144144
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: alias1[#FooEnum#]; name=alias1
145+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): FooEnum#})[#(into: inout Hasher) -> Void#]; name=hash(self: FooEnum)
146+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases({#arrayLiteral: FooEnum...#})[#Array<FooEnum>#]; name=AllCases(arrayLiteral: FooEnum...)
147+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases()[#Array<FooEnum>#]; name=AllCases()
148+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases({#(s): Sequence#})[#Array<FooEnum>#]; name=AllCases(s: Sequence)
149+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases({#repeating: FooEnum#}, {#count: Int#})[#Array<FooEnum>#]; name=AllCases(repeating: FooEnum, count: Int)
150+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases({#unsafeUninitializedCapacity: Int#}, {#initializingWith: (inout UnsafeMutableBufferPointer<FooEnum>, inout Int) throws -> Void##(inout UnsafeMutableBufferPointer<FooEnum>, inout Int) throws -> Void#})[' rethrows'][#Array<FooEnum>#]; name=AllCases(unsafeUninitializedCapacity: Int, initializingWith: (inout UnsafeMutableBufferPointer<FooEnum>, inout Int) throws -> Void) rethrows
151+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[Constructor]/CurrNominal/IsSystem: AllCases({#from: Decoder#})[' throws'][#Array<FooEnum>#]; name=AllCases(from: Decoder) throws
152+
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[StaticVar]/CurrNominal: allCases[#[FooEnum]#]; name=allCases
145153
// FOO_ENUM_DOT_ELEMENTS-NEXT: End completions
146154

147155
enum BarEnum {
@@ -454,9 +462,19 @@ func testWithInvalid1() {
454462

455463
func testUnqualified1(x: QuxEnum) {
456464
_ = x == .Qux1 || x == .#^UNRESOLVED_2^#Qux2
457-
// UNRESOLVED_2: Begin completions, 2 items
465+
// UNRESOLVED_2: Begin completions, 12 items
458466
// UNRESOLVED_2-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Qux1[#QuxEnum#]; name=Qux1
459467
// UNRESOLVED_2-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Qux2[#QuxEnum#]; name=Qux2
468+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#bitPattern: UInt#})[#Int#]; name=RawValue(bitPattern: UInt)
469+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#(source): Float#})[#Int#]; name=RawValue(source: Float)
470+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#(source): Double#})[#Int#]; name=RawValue(source: Double)
471+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#(source): Float80#})[#Int#]; name=RawValue(source: Float80)
472+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#from: Decoder#})[' throws'][#Int#]; name=RawValue(from: Decoder) throws
473+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#bitPattern: OpaquePointer?#})[#Int#]; name=RawValue(bitPattern: OpaquePointer?)
474+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#bitPattern: ObjectIdentifier#})[#Int#]; name=RawValue(bitPattern: ObjectIdentifier)
475+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal/IsSystem: RawValue({#bitPattern: _Pointer?#})[#Int#]; name=RawValue(bitPattern: _Pointer?)
476+
// UNRESOLVED_2-DAG: Decl[Constructor]/CurrNominal: init({#rawValue: Int#})[#QuxEnum?#]; name=init(rawValue: Int)
477+
// UNRESOLVED_2-DAG: Decl[InstanceMethod]/Super/IsSystem/TypeRelation[Invalid]: hash({#(self): QuxEnum#})[#(into: inout Hasher) -> Void#]; name=hash(self: QuxEnum)
460478
// UNRESOLVED_2: End completions
461479

462480
_ = (x == .Qux1#^UNRESOLVED_3^#)

test/IDE/complete_property_delegate_attribute.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ struct TestStruct {
3434

3535
@MyStruct(arg1: .#^ARG_MyEnum_DOT^#
3636
var test3
37-
// ARG_MyEnum_DOT: Begin completions, 2 items
37+
// ARG_MyEnum_DOT: Begin completions, 3 items
3838
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: east[#MyEnum#]; name=east
3939
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: west[#MyEnum#]; name=west
40+
// ARG_MyEnum_DOT-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): MyEnum#})[#(into: inout Hasher) -> Void#];
4041
// ARG_MyEnum_DOT: End completions
4142

4243
@MyStruct(arg1: MyEnum.#^ARG_MyEnum_NOBINDING^#)

test/IDE/complete_stmt_controlling_expr.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,17 @@ func testGuardCase(x:FooStruct?) {
644644
// FOOSTRUCT_LOCALVAL-DAG: Decl[LocalVar]/Local{{(/TypeRelation\[Convertible\])?}}: boundVal[#FooStruct#];
645645
// FOOSTRUCT_LOCALVAL: End completions
646646

647-
// OPTIONAL_FOOSTRUCT: Begin completions, 5 items
647+
// OPTIONAL_FOOSTRUCT: Begin completions, 9 items
648648
// OPTIONAL_FOOSTRUCT-DAG: Keyword[nil]/None/Erase[1]: nil[#FooStruct?#]; name=nil
649649
// OPTIONAL_FOOSTRUCT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: none[#Optional<FooStruct>#]; name=none
650650
// OPTIONAL_FOOSTRUCT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: some({#FooStruct#})[#Optional<FooStruct>#]; name=some(FooStruct)
651651
// FIXME: 'FooStruct' members should not be shown.
652652
// OPTIONAL_FOOSTRUCT-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Convertible]: init()[#FooStruct#]; name=init()
653653
// OPTIONAL_FOOSTRUCT-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Convertible]: init({#Int#})[#FooStruct#]; name=init(Int)
654+
// OPTIONAL_FOOSTRUCT-DAG: Decl[InstanceMethod]/CurrNominal: boolGen({#(self): FooStruct#})[#() -> Bool#]; name=boolGen(self: FooStruct)
655+
// OPTIONAL_FOOSTRUCT-DAG: Decl[InstanceMethod]/CurrNominal: intGen({#(self): FooStruct#})[#() -> Int#]; name=intGen(self: FooStruct)
656+
// OPTIONAL_FOOSTRUCT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: map({#(self): Optional<FooStruct>#})[#((FooStruct) throws -> U) -> U?#]; name=map(self: Optional<FooStruct>)
657+
// OPTIONAL_FOOSTRUCT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: flatMap({#(self): Optional<FooStruct>#})[#((FooStruct) throws -> U?) -> U?#]; name=flatMap(self: Optional<FooStruct>)
658+
// OPTIONAL_FOOSTRUCT-NOT: init({#(some):
659+
// OPTIONAL_FOOSTRUCT-NOT: init({#nilLiteral:
654660
// OPTIONAL_FOOSTRUCT: End completions

test/IDE/complete_string_interpolation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ struct MsgInterpolation: StringInterpolationProtocol {
3131
var messenger = Messenger()
3232
func testMessenger(intVal: Int, fltVal: Float) {
3333
messenger.send(" \(intVal, format: .#^OVERLOAD_INT^#) ")
34-
// OVERLOAD_INT: Begin completions, 4 items
34+
// OVERLOAD_INT: Begin completions, 5 items
3535
// OVERLOAD_INT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: decimal[#MsgInterpolation.IntFormat#];
3636
// OVERLOAD_INT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: hex[#MsgInterpolation.IntFormat#];
37+
// OVERLOAD_INT-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): MsgInterpolation.IntFormat#})[#(into: inout Hasher) -> Void#];
3738
// OVERLOAD_INT-DAG: Decl[StaticMethod]/CurrNominal/TypeRelation[Identical]: precision({#Int#})[#MsgInterpolation.FloatFormat#];
3839
// OVERLOAD_INT-DAG: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: hex[#MsgInterpolation.FloatFormat#];
3940
// OVERLOAD_INT: End completions
4041

4142
messenger.send(" \(fltVal, format: .#^OVERLOAD_FLT^#) ")
42-
// OVERLOAD_FLT: Begin completions, 4 items
43+
// OVERLOAD_FLT: Begin completions, 5 items
4344
// OVERLOAD_FLT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: decimal[#MsgInterpolation.IntFormat#];
4445
// OVERLOAD_FLT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: hex[#MsgInterpolation.IntFormat#];
46+
// OVERLOAD_FLT-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): MsgInterpolation.IntFormat#})[#(into: inout Hasher) -> Void#];
4547
// OVERLOAD_FLT-DAG: Decl[StaticMethod]/ExprSpecific/TypeRelation[Identical]: precision({#Int#})[#MsgInterpolation.FloatFormat#];
4648
// OVERLOAD_FLT-DAG: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: hex[#MsgInterpolation.FloatFormat#];
4749
// OVERLOAD_FLT: End completions

0 commit comments

Comments
 (0)