|
7 | 7 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1 | %FileCheck %s -check-prefix=RETURN_TR1
|
8 | 8 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2 | %FileCheck %s -check-prefix=RETURN_TR2
|
9 | 9 | // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3 | %FileCheck %s -check-prefix=RETURN_TR3
|
| 10 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1_METHOD | %FileCheck %s -check-prefix=RETURN_TR1 |
| 11 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2_METHOD | %FileCheck %s -check-prefix=RETURN_TR2 |
| 12 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3_METHOD | %FileCheck %s -check-prefix=RETURN_TR3 |
| 13 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1_STATICMETHOD | %FileCheck %s -check-prefix=RETURN_TR1 |
| 14 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2_STATICMETHOD | %FileCheck %s -check-prefix=RETURN_TR2 |
| 15 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3_STATICMETHOD | %FileCheck %s -check-prefix=RETURN_TR3 |
| 16 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1_CLOSURE | %FileCheck %s -check-prefix=RETURN_TR1 |
| 17 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2_CLOSURE | %FileCheck %s -check-prefix=RETURN_TR2 |
| 18 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3_CLOSURE | %FileCheck %s -check-prefix=RETURN_TR3 |
10 | 19 |
|
11 | 20 | struct FooStruct {
|
12 | 21 | var instanceVar : Int
|
@@ -104,3 +113,47 @@ func testTR3(_ g : Gen) -> Int? {
|
104 | 113 | // RETURN_TR3-DAG: Decl[InstanceMethod]/CurrNominal: InternalStringOpGen()[#String?#]{{; name=.+$}}
|
105 | 114 | // RETURN_TR3-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: InternalIntTaker({#(i1): Int#}, {#i2: Int#})[#Void#]{{; name=.+$}}
|
106 | 115 | // RETURN_TR3-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: InternalStringTaker({#(s1): String#}, {#s2: String#})[#Void#]{{; name=.+$}}
|
| 116 | + |
| 117 | +struct TestStruct { |
| 118 | + func testTR1_method() -> Int? { |
| 119 | + var i : Int |
| 120 | + var oi : Int? |
| 121 | + var fs : FooStruct |
| 122 | + return #^RETURN_TR1_METHOD^# |
| 123 | + } |
| 124 | + func testTR2_method(_ g : Gen) -> Int? { |
| 125 | + return g.#^RETURN_TR2_METHOD^# |
| 126 | + } |
| 127 | + func testTR3_method(_ g : Gen) -> Int? { |
| 128 | + return g.IG.#^RETURN_TR3_METHOD^# |
| 129 | + } |
| 130 | + |
| 131 | + static func testTR1_static() -> Int? { |
| 132 | + var i : Int |
| 133 | + var oi : Int? |
| 134 | + var fs : FooStruct |
| 135 | + return #^RETURN_TR1_STATICMETHOD^# |
| 136 | + } |
| 137 | + static func testTR2_static(_ g : Gen) -> Int? { |
| 138 | + return g.#^RETURN_TR2_STATICMETHOD^# |
| 139 | + } |
| 140 | + static func testTR3_static(_ g : Gen) -> Int? { |
| 141 | + return g.IG.#^RETURN_TR3_STATICMETHOD^# |
| 142 | + } |
| 143 | +} |
| 144 | + |
| 145 | +func testClosures(_ g: Gen) { |
| 146 | + var i : Int |
| 147 | + var oi : Int? |
| 148 | + var fs : FooStruct |
| 149 | + |
| 150 | + _ = { () -> Int? in |
| 151 | + return #^RETURN_TR1_CLOSURE^# |
| 152 | + } |
| 153 | + _ = { () -> Int? in |
| 154 | + return g.#^RETURN_TR2_CLOSURE^# |
| 155 | + } |
| 156 | + _ = { () -> Int? in |
| 157 | + return g.IG.#^RETURN_TR3_CLOSURE^# |
| 158 | + } |
| 159 | +} |
0 commit comments