17
17
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FALLBACK_2 | %FileCheck %s -check-prefix=INIT_FALLBACK
18
18
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBERDECL_SAMELINE | %FileCheck %s -check-prefix=MEMBERDECL_SAMELINE
19
19
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBERDECL_NEWLINE | %FileCheck %s -check-prefix=MEMBERDECL_NEWLINE
20
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INITIALIZED_VARDECL_SAMELINE | %FileCheck %s -check-prefix=INITIALIZED_VARDECL_SAMELINE
21
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INITIALIZED_VARDECL_NEWLINE | %FileCheck %s -check-prefix=INITIALIZED_VARDECL_NEWLINE
20
22
21
23
func globalFunc1( fn1: ( ) -> Int , fn2: ( ) -> String ) { }
22
24
func testGlobalFunc( ) {
@@ -27,8 +29,8 @@ func testGlobalFunc() {
27
29
// GLOBALFUNC_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
28
30
// GLOBALFUNC_SAMELINE: End completions
29
31
30
- // GLOBALFUNC_NEWLINE: Begin completions, 1 items
31
- // GLOBALFUNC_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
32
+ // GLOBALFUNC_NEWLINE: Begin completions
33
+ // FIXME- GLOBALFUNC_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
32
34
// GLOBALFUNC_NEWLINE: End completions
33
35
34
36
globalFunc1 ( )
@@ -60,7 +62,7 @@ func testMethod(value: MyStruct) {
60
62
// METHOD_SAMELINE: End completions
61
63
62
64
// METHOD_NEWLINE: Begin completions
63
- // METHOD_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)? {|}#}[#(() -> String)?#];
65
+ // FIXME- METHOD_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)? {|}#}[#(() -> String)?#];
64
66
// METHOD_NEWLINE-DAG: Keyword[class]/None: class;
65
67
// METHOD_NEWLINE-DAG: Keyword[if]/None: if;
66
68
// METHOD_NEWLINE-DAG: Keyword[try]/None: try;
@@ -91,8 +93,8 @@ func testOverloadedInit() {
91
93
// INIT_OVERLOADED_SAMELINE: End completions
92
94
93
95
// INIT_OVERLOADED_NEWLINE: Begin completions
94
- // INIT_OVERLOADED_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
95
- // INIT_OVERLOADED_NEWLINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
96
+ // FIXME- INIT_OVERLOADED_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
97
+ // FIXME- INIT_OVERLOADED_NEWLINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
96
98
// INIT_OVERLOADED_NEWLINE-DAG: Keyword[class]/None: class;
97
99
// INIT_OVERLOADED_NEWLINE-DAG: Keyword[if]/None: if;
98
100
// INIT_OVERLOADED_NEWLINE-DAG: Keyword[try]/None: try;
@@ -118,8 +120,8 @@ func testOptionalInit() {
118
120
// INIT_OPTIONAL_SAMELINE: End completions
119
121
120
122
// INIT_OPTIONAL_NEWLINE: Begin completions
121
- // INIT_OPTIONAL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
122
- // INIT_OPTIONAL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
123
+ // FIXME- INIT_OPTIONAL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
124
+ // FIXME- INIT_OPTIONAL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
123
125
// INIT_OPTIONAL_NEWLINE-DAG: Keyword[class]/None: class;
124
126
// INIT_OPTIONAL_NEWLINE-DAG: Keyword[if]/None: if;
125
127
// INIT_OPTIONAL_NEWLINE-DAG: Keyword[try]/None: try;
@@ -142,8 +144,8 @@ func testOptionalInit() {
142
144
// INIT_REQUIRED_SAMELINE_1-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
143
145
// INIT_REQUIRED_SAMELINE_1: End completions
144
146
145
- // INIT_REQUIRED_NEWLINE_1: Begin completions, 1 items
146
- // INIT_REQUIRED_NEWLINE_1-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
147
+ // INIT_REQUIRED_NEWLINE_1: Begin completions
148
+ // FIXME- INIT_REQUIRED_NEWLINE_1-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
147
149
// INIT_REQUIRED_NEWLINE_1: End completions
148
150
149
151
// missing 'fn3'.
@@ -158,8 +160,8 @@ func testOptionalInit() {
158
160
// INIT_REQUIRED_SAMELINE_2-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
159
161
// INIT_REQUIRED_SAMELINE_2: End completions
160
162
161
- // INIT_REQUIRED_NEWLINE_2: Begin completions, 1 items
162
- // INIT_REQUIRED_NEWLINE_2-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
163
+ // INIT_REQUIRED_NEWLINE_2: Begin completions
164
+ // FIXME- INIT_REQUIRED_NEWLINE_2-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
163
165
// INIT_REQUIRED_NEWLINE_2: End completions
164
166
165
167
// Call is completed.
@@ -225,7 +227,7 @@ struct TestNominalMember: P {
225
227
// MEMBERDECL_SAMELINE: End completions
226
228
227
229
// MEMBERDECL_NEWLINE: Begin completions
228
- // MEMBERDECL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)? {|}#}[#(() -> String)?#]; name=fn2: (() -> String)?
230
+ // FIXME- MEMBERDECL_NEWLINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)? {|}#}[#(() -> String)?#]; name=fn2: (() -> String)?
229
231
// MEMBERDECL_NEWLINE-DAG: Keyword[enum]/None: enum; name=enum
230
232
// MEMBERDECL_NEWLINE-DAG: Keyword[func]/None: func; name=func
231
233
// MEMBERDECL_NEWLINE-DAG: Keyword[private]/None: private; name=private
@@ -234,3 +236,22 @@ struct TestNominalMember: P {
234
236
// MEMBERDECL_NEWLINE-DAG: Decl[InstanceMethod]/Super: func foo() {|}; name=foo()
235
237
// MEMBERDECL_NEWLINE: End completions
236
238
}
239
+
240
+ func testInitializedVarDecl( ) {
241
+ let localVal = TestStruct {
242
+ 1
243
+ } #^INITIALIZED_VARDECL_SAMELINE^#
244
+ #^INITIALIZED_VARDECL_NEWLINE^#
245
+ // INITIALIZED_VARDECL_SAMELINE: Begin completions, 4 items
246
+ // INITIALIZED_VARDECL_SAMELINE-NOT: localVal
247
+ // INITIALIZED_VARDECL_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: () -> String {|}#}[#() -> String#];
248
+ // INITIALIZED_VARDECL_SAMELINE-DAG: Pattern/ExprSpecific: {#fn3: () -> String {|}#}[#() -> String#];
249
+ // INITIALIZED_VARDECL_SAMELINE-DAG: Decl[InstanceMethod]/CurrNominal: .testStructMethod()[#Void#];
250
+ // INITIALIZED_VARDECL_SAMELINE-DAG: Keyword[self]/CurrNominal: .self[#TestStruct#];
251
+ // INITIALIZED_VARDECL_SAMELINE-NOT: localVal
252
+ // INITIALIZED_VARDECL_SAMELINE: End completions
253
+
254
+ // INITIALIZED_VARDECL_NEWLINE: Begin completions
255
+ // INITIALIZED_VARDECL_NEWLINE-DAG: Decl[LocalVar]/Local: localVal[#TestStruct#];
256
+ // INITIALIZED_VARDECL_NEWLINE: End completions
257
+ }
0 commit comments