|
| 1 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_1 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 2 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_2 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 3 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_3 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 4 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_4 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 5 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_5 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 6 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_6 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 7 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_7 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 8 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_8 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 9 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_9 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 10 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_10 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 11 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_11 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 12 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_ATOM_12 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 13 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IF_CASE_1 | %FileCheck %s -check-prefix=GLOBAL |
| 14 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IF_CASE_2 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 15 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_1 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 16 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_2 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 17 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_3 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 18 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_4 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 19 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_5 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 20 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_6 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 21 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_7 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 22 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_8 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 23 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_9 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 24 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_10 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 25 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_11 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 26 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_ATOM_12 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
| 27 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_IF_CASE_1 | %FileCheck %s -check-prefix=GLOBAL |
| 28 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_INFUNC_IF_CASE_2 | %FileCheck %s -check-prefix=NO_COMPLETIONS |
1 | 29 |
|
| 30 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_1 > %t.types.txt |
| 31 | +// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt |
2 | 32 |
|
3 | 33 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_1 > %t.types.txt
|
4 | 34 | // RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
|
@@ -60,19 +90,55 @@ protocol BarProtocol {
|
60 | 90 |
|
61 | 91 | typealias FooTypealias = Int
|
62 | 92 |
|
| 93 | +// GLOBAL: Begin completions |
| 94 | +// GLOBAL-DAG: fooObject |
| 95 | +// GLOBAL-DAG: fooFunc |
| 96 | +// GLOBAL-DAG: FooTypealias |
| 97 | +// GLOBAL-DAG: FooProtocol |
| 98 | +// GLOBAL-DAG: FooClass |
| 99 | +// GLOBAL: End completions |
| 100 | + |
63 | 101 | // GLOBAL_NEGATIVE-NOT: fooObject
|
64 | 102 | // GLOBAL_NEGATIVE-NOT: fooFunc
|
65 | 103 |
|
66 | 104 | //===---
|
67 | 105 | //===--- Test that we don't try to suggest anything where pattern-atom is expected.
|
68 | 106 | //===---
|
69 | 107 |
|
70 |
| -var #^PATTERN_ATOM_1^# |
71 |
| -var (#^PATTERN_ATOM_2^# |
72 |
| -var (a, #^PATTERN_ATOM_3^# |
73 |
| -var (a #^PATTERN_ATOM_4^# |
74 |
| -var ((#^PATTERN_ATOM_5^# |
75 |
| -var ((a, b), #^PATTERN_ATOM_6^# |
| 108 | +// NO_COMPLETIONS-NOT: Begin completions |
| 109 | + |
| 110 | +// Use do { } to reset the parser after broken syntax. |
| 111 | +do { var #^PATTERN_ATOM_1^# } |
| 112 | +do { var (#^PATTERN_ATOM_2^# } |
| 113 | +do {var (a, #^PATTERN_ATOM_3^# } |
| 114 | +do {var (a #^PATTERN_ATOM_4^# } |
| 115 | +do {var ((#^PATTERN_ATOM_5^# } |
| 116 | +do {var ((a, b), #^PATTERN_ATOM_6^# } |
| 117 | +do {guard var #^PATTERN_ATOM_7^# } |
| 118 | +do {guard var #^PATTERN_ATOM_8^# else { fatalError() } } |
| 119 | +do {guard let #^PATTERN_ATOM_9^# else { fatalError() } } |
| 120 | +do {guard let a = Optional(1), let #^PATTERN_ATOM_10^# else { fatalError() } } |
| 121 | +do {if let #^PATTERN_ATOM_11^# {} } |
| 122 | +do {if let a = Optional(1), let #^PATTERN_ATOM_12^# {} } |
| 123 | +do {if case #^PATTERN_IF_CASE_1^# {} } |
| 124 | +do {if case let #^PATTERN_IF_CASE_2^# {} } |
| 125 | + |
| 126 | +func inFunc() { |
| 127 | + do { var #^PATTERN_INFUNC_ATOM_1^# } |
| 128 | + do { var (#^PATTERN_INFUNC_ATOM_2^# } |
| 129 | + do {var (a, #^PATTERN_INFUNC_ATOM_3^# } |
| 130 | + do {var (a #^PATTERN_INFUNC_ATOM_4^# } |
| 131 | + do {var ((#^PATTERN_INFUNC_ATOM_5^# } |
| 132 | + do {var ((a, b), #^PATTERN_INFUNC_ATOM_6^# } |
| 133 | + do {guard var #^PATTERN_INFUNC_ATOM_7^# } |
| 134 | + do {guard var #^PATTERN_INFUNC_ATOM_8^# else { fatalError() } } |
| 135 | + do {guard let #^PATTERN_INFUNC_ATOM_9^# else { fatalError() } } |
| 136 | + do {guard let a = Optional(1), let #^PATTERN_INFUNC_ATOM_10^# else { fatalError() } } |
| 137 | + do {if let #^PATTERN_INFUNC_ATOM_11^# {} } |
| 138 | + do {if let a = Optional(1), let #^PATTERN_INFUNC_ATOM_12^# {} } |
| 139 | + do {if case #^PATTERN_INFUNC_IF_CASE_1^# {} } |
| 140 | + do {if case let #^PATTERN_INFUNC_IF_CASE_2^# {} } |
| 141 | +} |
76 | 142 |
|
77 | 143 | //===---
|
78 | 144 | //===--- Test that we complete the type in 'is' pattern.
|
|
0 commit comments