6
6
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureUnresolved | %FileCheck %s -check-prefix=TestSingleExprClosureRetUnresolved
7
7
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureCall | %FileCheck %s -check-prefix=TestSingleExprClosure
8
8
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureGlobal | %FileCheck %s -check-prefix=TestSingleExprClosureGlobal
9
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestNonSingleExprClosureGlobal | %FileCheck %s -check-prefix=TestNonSingleExprClosureGlobal
10
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestNonSingleExprClosureUnresolved | %FileCheck %s -check-prefix=TestNonSingleExprClosureUnresolved
9
11
10
12
struct TestSingleExprClosureRet {
11
13
func void( ) -> Void { }
@@ -125,7 +127,7 @@ struct TestSingleExprClosureGlobal {
125
127
func int( ) -> Int { return 0 }
126
128
127
129
func test( ) -> Int {
128
- return { ( ) -> Int in
130
+ return { ( ) in
129
131
#^TestSingleExprClosureGlobal^#
130
132
} ( )
131
133
}
@@ -135,3 +137,37 @@ struct TestSingleExprClosureGlobal {
135
137
// TestSingleExprClosureGlobal-DAG: Decl[InstanceMethod]/OutNominal: void()[#Void#];
136
138
// TestSingleExprClosureGlobal: End completions
137
139
}
140
+
141
+ struct TestNonSingleExprClosureGlobal {
142
+ func void( ) -> Void { }
143
+ func str( ) -> String { return " " }
144
+ func int( ) -> Int { return 0 }
145
+
146
+ func test( ) -> Int {
147
+ return { ( ) in
148
+ #^TestNonSingleExprClosureGlobal^#
149
+ return 42
150
+ } ( )
151
+ }
152
+ // TestNonSingleExprClosureGlobal: Begin completions
153
+ // TestNonSingleExprClosureGlobal-DAG: Decl[InstanceMethod]/OutNominal: str()[#String#];
154
+ // TestNonSingleExprClosureGlobal-DAG: Decl[InstanceMethod]/OutNominal: int()[#Int#];
155
+ // TestNonSingleExprClosureGlobal-DAG: Decl[InstanceMethod]/OutNominal: void()[#Void#];
156
+ // TestNonSingleExprClosureGlobal: End completions
157
+ }
158
+
159
+ struct TestNonSingleExprClosureUnresolved {
160
+ enum MyEnum { case myEnum }
161
+ enum NotMine { case notMine }
162
+ func mine( ) -> MyEnum { return . myEnum }
163
+ func notMine( ) -> NotMine { return . notMine }
164
+
165
+ func test( ) -> Int {
166
+ return { ( ) in
167
+ . #^TestNonSingleExprClosureUnresolved^#
168
+ return 42
169
+ } ( )
170
+ }
171
+ // TestNonSingleExprClosureUnresolved-NOT: myEnum
172
+ // TestNonSingleExprClosureUnresolved-NOT: notMine
173
+ }
0 commit comments