|
57 | 57 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | FileCheck %s -check-prefix=MY_ALIAS
|
58 | 58 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | FileCheck %s -check-prefix=MY_ALIAS
|
59 | 59 |
|
| 60 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_1 | FileCheck %s -check-prefix=IN_FOR_EACH_1 |
| 61 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_2 | FileCheck %s -check-prefix=IN_FOR_EACH_1 |
| 62 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_3 | FileCheck %s -check-prefix=IN_FOR_EACH_3 |
| 63 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_4 | FileCheck %s -check-prefix=IN_FOR_EACH_3 |
| 64 | + |
60 | 65 | //
|
61 | 66 | // Test code completion at the beginning of expr-postfix.
|
62 | 67 | //
|
@@ -407,3 +412,46 @@ func testGenericTypealias2() {
|
407 | 412 | var y: MyAlias<Int>
|
408 | 413 | y = #^GENERIC_TYPEALIAS_2^#
|
409 | 414 | }
|
| 415 | + |
| 416 | +func testInForEach1(arg: Int) { |
| 417 | + let local = 2 |
| 418 | + for index in #^IN_FOR_EACH_1^# { |
| 419 | + let inBody = 3 |
| 420 | + } |
| 421 | + let after = 4 |
| 422 | +// IN_FOR_EACH_1-NOT: Decl[LocalVar] |
| 423 | +// IN_FOR_EACH_1: Decl[LocalVar]/Local: local[#Int#]; |
| 424 | +// FIXME: shouldn't show 'after' here. |
| 425 | +// IN_FOR_EACH_1: Decl[LocalVar]/Local: after[#Int#]; |
| 426 | +// IN_FOR_EACH_1: Decl[LocalVar]/Local: arg[#Int#]; |
| 427 | +// IN_FOR_EACH_1-NOT: Decl[LocalVar] |
| 428 | +} |
| 429 | +func testInForEach2(arg: Int) { |
| 430 | + let local = 2 |
| 431 | + for index in 1 ... #^IN_FOR_EACH_2^# { |
| 432 | + let inBody = 3 |
| 433 | + } |
| 434 | + let after = 4 |
| 435 | +} |
| 436 | +func testInForEach3(arg: Int) { |
| 437 | + let local = 2 |
| 438 | + for index: Int in 1 ... 2 where #^IN_FOR_EACH_3^# { |
| 439 | + let inBody = 3 |
| 440 | + } |
| 441 | + let after = 4 |
| 442 | +// IN_FOR_EACH_3-NOT: Decl[LocalVar] |
| 443 | +// IN_FOR_EACH_3: Decl[LocalVar]/Local: index[#Int#]; |
| 444 | +// IN_FOR_EACH_3-NOT: Decl[LocalVar] |
| 445 | +// IN_FOR_EACH_3: Decl[LocalVar]/Local: local[#Int#]; |
| 446 | +// FIXME: shouldn't show 'after' here. |
| 447 | +// IN_FOR_EACH_3: Decl[LocalVar]/Local: after[#Int#]; |
| 448 | +// IN_FOR_EACH_3: Decl[LocalVar]/Local: arg[#Int#]; |
| 449 | +// IN_FOR_EACH_3-NOT: Decl[LocalVar] |
| 450 | +} |
| 451 | +func testInForEach4(arg: Int) { |
| 452 | + let local = 2 |
| 453 | + for index in 1 ... 2 { |
| 454 | + #^IN_FOR_EACH_4^# |
| 455 | + } |
| 456 | + let after = 4 |
| 457 | +} |
0 commit comments