2
2
3
3
// REQUIRES: executable_test
4
4
5
+ // https://github.com/apple/swift/issues/53611
5
6
// Even though we test that type-checking and exhaustiveness checking work fine
6
7
// in the presence of implicit tupling/untupling in exhaustive_switch.swift,
7
8
// make sure that the "patched" patterns do not lead to incorrect codegen.
@@ -12,46 +13,46 @@ enum Untupled {
12
13
13
14
let u_ex = Untupled . upair ( 1 , 2 )
14
15
15
- func sr11212_content_untupled_pattern_tupled1 ( u: Untupled ) -> ( Int , Int ) {
16
+ func content_untupled_pattern_tupled1 ( u: Untupled ) -> ( Int , Int ) {
16
17
switch u { case . upair( ( let x, let y) ) : return ( x, y) }
17
18
}
18
- print ( sr11212_content_untupled_pattern_tupled1 ( u: u_ex) )
19
+ print ( content_untupled_pattern_tupled1 ( u: u_ex) )
19
20
// CHECK: (1, 2)
20
21
21
- func sr11212_content_untupled_pattern_tupled2 ( u: Untupled ) -> ( Int , Int ) {
22
+ func content_untupled_pattern_tupled2 ( u: Untupled ) -> ( Int , Int ) {
22
23
switch u { case . upair( let ( x, y) ) : return ( x, y) }
23
24
}
24
- print ( sr11212_content_untupled_pattern_tupled2 ( u: u_ex) )
25
+ print ( content_untupled_pattern_tupled2 ( u: u_ex) )
25
26
// CHECK: (1, 2)
26
27
27
- func sr11212_content_untupled_pattern_tupled3 ( u: Untupled ) -> ( Int , Int ) {
28
+ func content_untupled_pattern_tupled3 ( u: Untupled ) -> ( Int , Int ) {
28
29
switch u { case let . upair( ( x, y) ) : return ( x, y) }
29
30
}
30
- print ( sr11212_content_untupled_pattern_tupled3 ( u: u_ex) )
31
+ print ( content_untupled_pattern_tupled3 ( u: u_ex) )
31
32
// CHECK: (1, 2)
32
33
33
- func sr11212_content_untupled_pattern_untupled1 ( u: Untupled ) -> ( Int , Int ) {
34
+ func content_untupled_pattern_untupled1 ( u: Untupled ) -> ( Int , Int ) {
34
35
switch u { case . upair( let x, let y) : return ( x, y) }
35
36
}
36
- print ( sr11212_content_untupled_pattern_untupled1 ( u: u_ex) )
37
+ print ( content_untupled_pattern_untupled1 ( u: u_ex) )
37
38
// CHECK: (1, 2)
38
39
39
- func sr11212_content_untupled_pattern_untupled2 ( u: Untupled ) -> ( Int , Int ) {
40
+ func content_untupled_pattern_untupled2 ( u: Untupled ) -> ( Int , Int ) {
40
41
switch u { case let . upair( x, y) : return ( x, y) }
41
42
}
42
- print ( sr11212_content_untupled_pattern_untupled2 ( u: u_ex) )
43
+ print ( content_untupled_pattern_untupled2 ( u: u_ex) )
43
44
// CHECK: (1, 2)
44
45
45
- func sr11212_content_untupled_pattern_ambiguous1 ( u: Untupled ) -> ( Int , Int ) {
46
+ func content_untupled_pattern_ambiguous1 ( u: Untupled ) -> ( Int , Int ) {
46
47
switch u { case . upair( let u_) : return u_ }
47
48
}
48
- print ( sr11212_content_untupled_pattern_ambiguous1 ( u: u_ex) )
49
+ print ( content_untupled_pattern_ambiguous1 ( u: u_ex) )
49
50
// CHECK: (1, 2)
50
51
51
- func sr11212_content_untupled_pattern_ambiguous2 ( u: Untupled ) -> ( Int , Int ) {
52
+ func content_untupled_pattern_ambiguous2 ( u: Untupled ) -> ( Int , Int ) {
52
53
switch u { case let . upair( u_) : return u_ }
53
54
}
54
- print ( sr11212_content_untupled_pattern_ambiguous2 ( u: u_ex) )
55
+ print ( content_untupled_pattern_ambiguous2 ( u: u_ex) )
55
56
// CHECK: (1, 2)
56
57
57
58
enum Tupled {
@@ -60,46 +61,46 @@ enum Tupled {
60
61
61
62
let t_ex = Tupled . tpair ( ( 1 , 2 ) )
62
63
63
- func sr11212_content_tupled_pattern_tupled1 ( t: Tupled ) -> ( Int , Int ) {
64
+ func content_tupled_pattern_tupled1 ( t: Tupled ) -> ( Int , Int ) {
64
65
switch t { case . tpair( ( let x, let y) ) : return ( x, y) }
65
66
}
66
- print ( sr11212_content_tupled_pattern_tupled1 ( t: t_ex) )
67
+ print ( content_tupled_pattern_tupled1 ( t: t_ex) )
67
68
// CHECK: (1, 2)
68
69
69
- func sr11212_content_tupled_pattern_tupled2 ( t: Tupled ) -> ( Int , Int ) {
70
+ func content_tupled_pattern_tupled2 ( t: Tupled ) -> ( Int , Int ) {
70
71
switch t { case . tpair( let ( x, y) ) : return ( x, y) }
71
72
}
72
- print ( sr11212_content_tupled_pattern_tupled2 ( t: t_ex) )
73
+ print ( content_tupled_pattern_tupled2 ( t: t_ex) )
73
74
// CHECK: (1, 2)
74
75
75
- func sr11212_content_tupled_pattern_tupled3 ( t: Tupled ) -> ( Int , Int ) {
76
+ func content_tupled_pattern_tupled3 ( t: Tupled ) -> ( Int , Int ) {
76
77
switch t { case let . tpair( ( x, y) ) : return ( x, y) }
77
78
}
78
- print ( sr11212_content_tupled_pattern_tupled3 ( t: t_ex) )
79
+ print ( content_tupled_pattern_tupled3 ( t: t_ex) )
79
80
// CHECK: (1, 2)
80
81
81
- func sr11212_content_tupled_pattern_untupled1 ( t: Tupled ) -> ( Int , Int ) {
82
+ func content_tupled_pattern_untupled1 ( t: Tupled ) -> ( Int , Int ) {
82
83
switch t { case . tpair( let x, let y) : return ( x, y) }
83
84
}
84
- print ( sr11212_content_tupled_pattern_untupled1 ( t: t_ex) )
85
+ print ( content_tupled_pattern_untupled1 ( t: t_ex) )
85
86
// CHECK: (1, 2)
86
87
87
- func sr11212_content_tupled_pattern_untupled2 ( t: Tupled ) -> ( Int , Int ) {
88
+ func content_tupled_pattern_untupled2 ( t: Tupled ) -> ( Int , Int ) {
88
89
switch t { case let . tpair( x, y) : return ( x, y) }
89
90
}
90
- print ( sr11212_content_tupled_pattern_untupled2 ( t: t_ex) )
91
+ print ( content_tupled_pattern_untupled2 ( t: t_ex) )
91
92
// CHECK: (1, 2)
92
93
93
- func sr11212_content_tupled_pattern_ambiguous1 ( t: Tupled ) -> ( Int , Int ) {
94
+ func content_tupled_pattern_ambiguous1 ( t: Tupled ) -> ( Int , Int ) {
94
95
switch t { case . tpair( let t_) : return t_ }
95
96
}
96
- print ( sr11212_content_tupled_pattern_ambiguous1 ( t: t_ex) )
97
+ print ( content_tupled_pattern_ambiguous1 ( t: t_ex) )
97
98
// CHECK: (1, 2)
98
99
99
- func sr11212_content_tupled_pattern_ambiguous2 ( t: Tupled ) -> ( Int , Int ) {
100
+ func content_tupled_pattern_ambiguous2 ( t: Tupled ) -> ( Int , Int ) {
100
101
switch t { case let . tpair( t_) : return t_ }
101
102
}
102
- print ( sr11212_content_tupled_pattern_ambiguous2 ( t: t_ex) )
103
+ print ( content_tupled_pattern_ambiguous2 ( t: t_ex) )
103
104
// CHECK: (1, 2)
104
105
105
106
enum Box < T> {
@@ -108,44 +109,44 @@ enum Box<T> {
108
109
109
110
let b_ex : Box < ( Int , Int ) > = Box . box ( ( 1 , 2 ) )
110
111
111
- func sr11212_content_generic_pattern_tupled1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
112
+ func content_generic_pattern_tupled1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
112
113
switch b { case . box( ( let x, let y) ) : return ( x, y) }
113
114
}
114
- print ( sr11212_content_generic_pattern_tupled1 ( b: b_ex) )
115
+ print ( content_generic_pattern_tupled1 ( b: b_ex) )
115
116
// CHECK: (1, 2)
116
117
117
- func sr11212_content_generic_pattern_tupled2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
118
+ func content_generic_pattern_tupled2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
118
119
switch b { case . box( let ( x, y) ) : return ( x, y) }
119
120
}
120
- print ( sr11212_content_generic_pattern_tupled2 ( b: b_ex) )
121
+ print ( content_generic_pattern_tupled2 ( b: b_ex) )
121
122
// CHECK: (1, 2)
122
123
123
- func sr11212_content_generic_pattern_tupled3 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
124
+ func content_generic_pattern_tupled3 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
124
125
switch b { case let . box( ( x, y) ) : return ( x, y) }
125
126
}
126
- print ( sr11212_content_generic_pattern_tupled3 ( b: b_ex) )
127
+ print ( content_generic_pattern_tupled3 ( b: b_ex) )
127
128
// CHECK: (1, 2)
128
129
129
- func sr11212_content_generic_pattern_untupled1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
130
+ func content_generic_pattern_untupled1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
130
131
switch b { case . box( let x, let y) : return ( x, y) }
131
132
}
132
- print ( sr11212_content_generic_pattern_untupled1 ( b: b_ex) )
133
+ print ( content_generic_pattern_untupled1 ( b: b_ex) )
133
134
// CHECK: (1, 2)
134
135
135
- func sr11212_content_generic_pattern_untupled2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
136
+ func content_generic_pattern_untupled2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
136
137
switch b { case let . box( x, y) : return ( x, y) }
137
138
}
138
- print ( sr11212_content_generic_pattern_untupled2 ( b: b_ex) )
139
+ print ( content_generic_pattern_untupled2 ( b: b_ex) )
139
140
// CHECK: (1, 2)
140
141
141
- func sr11212_content_generic_pattern_ambiguous1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
142
+ func content_generic_pattern_ambiguous1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
142
143
switch b { case . box( let b_) : return b_ }
143
144
}
144
- print ( sr11212_content_generic_pattern_ambiguous1 ( b: b_ex) )
145
+ print ( content_generic_pattern_ambiguous1 ( b: b_ex) )
145
146
// CHECK: (1, 2)
146
147
147
- func sr11212_content_generic_pattern_ambiguous2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
148
+ func content_generic_pattern_ambiguous2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
148
149
switch b { case let . box( b_) : return b_ }
149
150
}
150
- print ( sr11212_content_generic_pattern_ambiguous2 ( b: b_ex) )
151
+ print ( content_generic_pattern_ambiguous2 ( b: b_ex) )
151
152
// CHECK: (1, 2)
0 commit comments