@@ -33,16 +33,26 @@ func testGlobalFunc() {
33
33
// GLOBALFUNC_AFTERLABEL-NOT: Begin completions
34
34
}
35
35
36
+ struct SimpleEnum {
37
+ case foo, bar
38
+
39
+ func enumFunc( ) { }
40
+ static func + ( lhs: SimpleEnum , rhs: SimpleEnum ) -> SimpleEnum { }
41
+ }
42
+
36
43
struct MyStruct {
37
- func method1( fn1: ( ) -> Int , fn2: ( ( ) -> String ) ? = nil ) { }
38
- func method1( fn1: ( ) -> Int , fn2: Int = nil ) { }
44
+ func method1( fn1: ( ) -> Int , fn2: ( ( ) -> String ) ? = nil ) -> SimpleEnum { }
45
+ func method1( fn1: ( ) -> Int , fn2: Int = nil ) -> SimpleEnum { }
39
46
}
40
47
func testMethod( value: MyStruct ) {
41
48
value. method1 {
42
49
} #^METHOD_SAMELINE^#
43
50
#^METHOD_NEWLINE^#
44
- // METHOD_SAMELINE: Begin completions, 1 items
51
+ // METHOD_SAMELINE: Begin completions, 4 items
45
52
// METHOD_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)?##() -> String#}[#(() -> String)?#];
53
+ // METHOD_SAMELINE-DAG: Decl[InstanceMethod]/CurrNominal: .enumFunc()[#Void#];
54
+ // METHOD_SAMELINE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']+ {#SimpleEnum#}[#SimpleEnum#];
55
+ // METHOD_SAMELINE-DAG: Keyword[self]/CurrNominal: .self[#SimpleEnum#];
46
56
// METHOD_SAMELINE: End completions
47
57
48
58
// METHOD_NEWLINE: Begin completions
@@ -59,6 +69,8 @@ struct TestStruct {
59
69
init ( fn1: ( ) -> Int ) { }
60
70
init ( fn1: ( ) -> Int , fn2: ( ) -> String ) { }
61
71
init ( fn1: ( ) -> Int , fn3: ( ) -> String ) { }
72
+
73
+ func testStructMethod( ) { }
62
74
}
63
75
64
76
func testOverloadedInit( ) {
@@ -67,9 +79,11 @@ func testOverloadedInit() {
67
79
} #^INIT_OVERLOADED_SAMELINE^#
68
80
#^INIT_OVERLOADED_NEWLINE^#
69
81
70
- // INIT_OVERLOADED_SAMELINE: Begin completions, 2 items
82
+ // INIT_OVERLOADED_SAMELINE: Begin completions, 4 items
71
83
// INIT_OVERLOADED_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String##() -> String#}[#() -> String#];
72
84
// INIT_OVERLOADED_SAMELINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String##() -> String#}[#() -> String#];
85
+ // INIT_OVERLOADED_SAMELINE-DAG: Decl[InstanceMethod]/CurrNominal: .testStructMethod()[#Void#];
86
+ // INIT_OVERLOADED_SAMELINE-DAG: Keyword[self]/CurrNominal: .self[#TestStruct#];
73
87
// INIT_OVERLOADED_SAMELINE: End completions
74
88
75
89
// INIT_OVERLOADED_NEWLINE: Begin completions
@@ -84,16 +98,19 @@ func testOverloadedInit() {
84
98
85
99
struct TestStruct2 {
86
100
init ( fn1: ( ) -> Int , fn2: ( ) -> String = { } , fn3: ( ) -> String = { } ) { }
101
+ func testStructMethod( ) { }
87
102
}
88
103
func testOptionalInit( ) {
89
104
TestStruct2 {
90
105
2
91
106
} #^INIT_OPTIONAL_SAMELINE^#
92
107
#^INIT_OPTIONAL_NEWLINE^#
93
108
94
- // INIT_OPTIONAL_SAMELINE: Begin completions, 2 items
109
+ // INIT_OPTIONAL_SAMELINE: Begin completions, 4 items
95
110
// INIT_OPTIONAL_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String##() -> String#}[#() -> String#];
96
111
// INIT_OPTIONAL_SAMELINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String##() -> String#}[#() -> String#];
112
+ // INIT_OPTIONAL_SAMELINE-DAG: Decl[InstanceMethod]/CurrNominal: .testStructMethod()[#Void#];
113
+ // INIT_OPTIONAL_SAMELINE-DAG: Keyword[self]/CurrNominal: .self[#TestStruct2#];
97
114
// INIT_OPTIONAL_SAMELINE: End completions
98
115
99
116
// INIT_OPTIONAL_NEWLINE: Begin completions
@@ -108,6 +125,7 @@ func testOptionalInit() {
108
125
109
126
struct TestStruct3 {
110
127
init ( fn1: ( ) -> Int , fn2: ( ) -> String , fn3: ( ) -> String ) { }
128
+ func testStructMethod( ) { }
111
129
}
112
130
func testOptionalInit( ) {
113
131
// missing 'fn2' and 'fn3'.
@@ -150,7 +168,10 @@ func testOptionalInit() {
150
168
} #^INIT_REQUIRED_SAMELINE_3^#
151
169
#^INIT_REQUIRED_NEWLINE_3 ^#
152
170
153
- // INIT_REQUIRED_SAMELINE_3-NOT: Begin completions
171
+ // INIT_REQUIRED_SAMELINE_3: Begin completions, 2 items
172
+ // INIT_REQUIRED_SAMELINE_3-DAG: Decl[InstanceMethod]/CurrNominal: .testStructMethod()[#Void#];
173
+ // INIT_REQUIRED_SAMELINE_3-DAG: Keyword[self]/CurrNominal: .self[#TestStruct3#];
174
+ // INIT_REQIORED_SAMELINE_3: End completions
154
175
155
176
// INIT_REQUIRED_NEWLINE_3: Begin completions
156
177
// INIT_REQUIRED_NEWLINE_3-NOT: name=fn2
0 commit comments