|
19 | 19 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERRIDE_TestStruct | %FileCheck %s -check-prefix=OVERRIDE
|
20 | 20 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERRIDE_HasTypealias | %FileCheck %s -check-prefix=OVERRIDE_HasTypealias
|
21 | 21 |
|
| 22 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_TestProtocol_DOT | %FileCheck %s -check-prefix=POSTFIX_TestProtocol_DOT |
| 23 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_TestProtocol_NODOT | %FileCheck %s -check-prefix=POSTFIX_TestProtocol_NODOT |
| 24 | + |
22 | 25 | protocol MyProtocol {
|
23 | 26 | associatedtype Mistery
|
24 | 27 | }
|
@@ -136,3 +139,37 @@ class HasTypealias : HasAssocWithConformanceConstraint {
|
136 | 139 | // OVERRIDE_HasTypealias-DAG: Decl[InstanceMethod]/Super: func returnAssocWithConformanceConstraint(fn: (Int) -> Int) -> ConcreteMyProtocol {|};
|
137 | 140 | // OVERRIDE_HasTypealias: End completions
|
138 | 141 | }
|
| 142 | + |
| 143 | +// MARK: Postfix expession for opaque result types. |
| 144 | + |
| 145 | +protocol TestProtocol { |
| 146 | + associatedtype Assoc1 |
| 147 | + associatedtype Assoc2: Comparable |
| 148 | + |
| 149 | + func foo(arg1: Assoc1, arg2: (Assoc2) -> Assoc1) -> Assoc2 |
| 150 | + subscript(idx: Assoc1, idx2: Assoc2) -> Self { get } |
| 151 | + var value: (Assoc1, Assoc2) { get } |
| 152 | +} |
| 153 | + |
| 154 | +func vendTestProtocol() -> some TestProtocol { |
| 155 | + <#code#> |
| 156 | +} |
| 157 | + |
| 158 | +func postfixExpr() { |
| 159 | + var value = vendTestProtocol() |
| 160 | + let _ = value.#^POSTFIX_TestProtocol_DOT^# |
| 161 | + let _ = value#^POSTFIX_TestProtocol_NODOT^# |
| 162 | +} |
| 163 | +// POSTFIX_TestProtocol_DOT: Begin completions, 3 items |
| 164 | +// POSTFIX_TestProtocol_DOT-DAG: Decl[InstanceMethod]/CurrNominal: foo({#arg1: TestProtocol.Assoc1#}, {#arg2: (Comparable) -> TestProtocol.Assoc1##(Comparable) -> TestProtocol.Assoc1#})[#Comparable#]; name={{.*$}} |
| 165 | +// POSTFIX_TestProtocol_DOT-DAG: Decl[InstanceVar]/CurrNominal: value[#(TestProtocol.Assoc1, Comparable)#]; name={{.*$}} |
| 166 | +// POSTFIX_TestProtocol_DOT-DAG: Keyword[self]/CurrNominal: self[#TestProtocol#]; name={{.*$}} |
| 167 | +// POSTFIX_TestProtocol_DOT: End completions |
| 168 | + |
| 169 | +// POSTFIX_TestProtocol_NODOT: Begin completions, 5 items |
| 170 | +// POSTFIX_TestProtocol_NODOT-DAG: Decl[InstanceMethod]/CurrNominal: .foo({#arg1: TestProtocol.Assoc1#}, {#arg2: (Comparable) -> TestProtocol.Assoc1##(Comparable) -> TestProtocol.Assoc1#})[#Comparable#]; name={{.*$}} |
| 171 | +// POSTFIX_TestProtocol_NODOT-DAG: Decl[Subscript]/CurrNominal: [{#(idx): TestProtocol.Assoc1#}, {#(idx2): Comparable#}][#TestProtocol#]; name={{.*$}} |
| 172 | +// POSTFIX_TestProtocol_NODOT-DAG: Decl[InstanceVar]/CurrNominal: .value[#(TestProtocol.Assoc1, Comparable)#]; name={{.*$}} |
| 173 | +// POSTFIX_TestProtocol_NODOT-DAG: BuiltinOperator/None: = {#TestProtocol#}[#Void#]; name={{.*$}} |
| 174 | +// POSTFIX_TestProtocol_NODOT-DAG: Keyword[self]/CurrNominal: .self[#TestProtocol#]; name={{.*$}} |
| 175 | +// POSTFIX_TestProtocol_NODOT-DAG: End completions |
0 commit comments