File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ do {
4
+ enum E : String , CaseIterable {
5
+ static var allCases : [ E ] {
6
+ [ . one, . two]
7
+ }
8
+
9
+ case one
10
+ case two
11
+
12
+ func test( id: String ) {
13
+ for c in Self . allCases where id == " \( c) " { // Ok
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+ do {
20
+ struct Data {
21
+ var text : String
22
+
23
+ static func fn( _: ( inout Data ) -> Void ) { }
24
+ static func fn( _: ( inout Int ) -> Void ) { }
25
+ }
26
+
27
+ func test< T> ( _: @autoclosure ( ) -> T ) {
28
+ }
29
+
30
+ test ( ( 1 ... 3 ) . map { number in Data . fn { $0. text = " \( number) " } } )
31
+
32
+ func test_multi< T> ( _: ( ) -> T ) {
33
+ }
34
+
35
+ test_multi {
36
+ let x = 1 ... 3
37
+ _ = x. map { number in
38
+ Data . fn {
39
+ if $0. text == " \( number) " {
40
+ $0. text = " \( x) "
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments