|
1 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 | FileCheck %s -check-prefix=KW_DECL_STMT |
| 1 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 > %t.top1 |
| 2 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.top1 |
| 3 | +// RUN: FileCheck %s -check-prefix=KW_NO_RETURN < %t.top1 |
2 | 4 |
|
3 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_1 | FileCheck %s -check-prefix=KW_DECL_STMT |
4 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_2 | FileCheck %s -check-prefix=KW_DECL_STMT |
5 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_3 | FileCheck %s -check-prefix=KW_DECL_STMT |
6 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_4 | FileCheck %s -check-prefix=KW_DECL_STMT |
7 |
| -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_5 | FileCheck %s -check-prefix=KW_DECL_STMT |
| 5 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_2 > %t.top2 |
| 6 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.top2 |
| 7 | +// RUN: FileCheck %s -check-prefix=KW_NO_RETURN < %t.top2 |
| 8 | + |
| 9 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_1 > %t.func1 |
| 10 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func1 |
| 11 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func1 |
| 12 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_2 > %t.func2 |
| 13 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func2 |
| 14 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func2 |
| 15 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_3 > %t.func3 |
| 16 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func3 |
| 17 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func3 |
| 18 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_4 > %t.func4 |
| 19 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func4 |
| 20 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func4 |
| 21 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_5 > %t.func5 |
| 22 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func5 |
| 23 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func5 |
| 24 | + |
| 25 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_1 > %t.clos1 |
| 26 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos1 |
| 27 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos1 |
| 28 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_2 > %t.clos2 |
| 29 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos2 |
| 30 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos2 |
| 31 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_3 > %t.clos3 |
| 32 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos3 |
| 33 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos3 |
| 34 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_4 > %t.clos4 |
| 35 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos4 |
| 36 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos4 |
| 37 | + |
| 38 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SUBSCRIPT_1 > %t.subs |
| 39 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.subs |
| 40 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.subs |
| 41 | + |
| 42 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INIT_1 > %t.init |
| 43 | +// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.init |
| 44 | +// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.init |
8 | 45 |
|
9 | 46 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_1 | FileCheck %s -check-prefix=KW_DECL
|
10 | 47 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_2 | FileCheck %s -check-prefix=KW_DECL
|
|
41 | 78 | // RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr6
|
42 | 79 | // RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr6
|
43 | 80 |
|
| 81 | +// KW_RETURN: Keyword[return]/None: return{{; name=.+$}} |
| 82 | +// KW_NO_RETURN-NOT: Keyword[return] |
| 83 | + |
44 | 84 | // KW_DECL: Begin completions
|
45 | 85 | // KW_DECL-DAG: Keyword[class]/None: class{{; name=.+$}}
|
46 | 86 | // KW_DECL-DAG: Keyword/None: convenience{{; name=.+$}}
|
|
121 | 161 | // KW_DECL_STMT-DAG: Keyword[for]/None: for{{; name=.+$}}
|
122 | 162 | // KW_DECL_STMT-DAG: Keyword[in]/None: in{{; name=.+$}}
|
123 | 163 | // KW_DECL_STMT-DAG: Keyword[while]/None: while{{; name=.+$}}
|
124 |
| -// KW_DECL_STMT-DAG: Keyword[return]/None: return{{; name=.+$}} |
125 | 164 | // KW_DECL_STMT-DAG: Keyword[break]/None: break{{; name=.+$}}
|
126 | 165 | // KW_DECL_STMT-DAG: Keyword[continue]/None: continue{{; name=.+$}}
|
127 | 166 | // KW_DECL_STMT-DAG: Keyword[fallthrough]/None: fallthrough{{; name=.+$}}
|
|
194 | 233 |
|
195 | 234 | #^TOP_LEVEL_1^#
|
196 | 235 |
|
| 236 | +for _ in 1...10 { |
| 237 | + #^TOP_LEVEL_2^# |
| 238 | +} |
| 239 | + |
197 | 240 | func testInFuncBody1() {
|
198 | 241 | #^IN_FUNC_BODY_1^#
|
199 | 242 | }
|
@@ -224,6 +267,25 @@ class InClassFunc {
|
224 | 267 | }
|
225 | 268 | }
|
226 | 269 |
|
| 270 | +func testInClosure1() { |
| 271 | + { #^IN_CLOSURE_1^# } |
| 272 | +} |
| 273 | +func testInClosure2() { |
| 274 | + { #^IN_CLOSURE_2^# |
| 275 | +} |
| 276 | +struct InVarClosureInit { |
| 277 | + let x = { #^IN_CLOSURE_3^# }() |
| 278 | +} |
| 279 | + |
| 280 | +{ #^IN_CLOSURE_4^# } |
| 281 | + |
| 282 | +struct InSubscript { |
| 283 | + subscript(x: Int) -> Int { #^IN_SUBSCRIPT_1^# } |
| 284 | +} |
| 285 | + |
| 286 | +struct InInit { |
| 287 | + init?() { #^IN_INIT_1^# } |
| 288 | +} |
227 | 289 |
|
228 | 290 | struct InStruct {
|
229 | 291 | #^IN_NOMINAL_DECL_1^#
|
|
0 commit comments