22
33// REQUIRES: executable_test
44
5+ // https://github.com/apple/swift/issues/53611
56// Even though we test that type-checking and exhaustiveness checking work fine
67// in the presence of implicit tupling/untupling in exhaustive_switch.swift,
78// make sure that the "patched" patterns do not lead to incorrect codegen.
@@ -12,46 +13,46 @@ enum Untupled {
1213
1314let u_ex = Untupled . upair ( 1 , 2 )
1415
15- func sr11212_content_untupled_pattern_tupled1 ( u: Untupled ) -> ( Int , Int ) {
16+ func content_untupled_pattern_tupled1 ( u: Untupled ) -> ( Int , Int ) {
1617 switch u { case . upair( ( let x, let y) ) : return ( x, y) }
1718}
18- print ( sr11212_content_untupled_pattern_tupled1 ( u: u_ex) )
19+ print ( content_untupled_pattern_tupled1 ( u: u_ex) )
1920// CHECK: (1, 2)
2021
21- func sr11212_content_untupled_pattern_tupled2 ( u: Untupled ) -> ( Int , Int ) {
22+ func content_untupled_pattern_tupled2 ( u: Untupled ) -> ( Int , Int ) {
2223 switch u { case . upair( let ( x, y) ) : return ( x, y) }
2324}
24- print ( sr11212_content_untupled_pattern_tupled2 ( u: u_ex) )
25+ print ( content_untupled_pattern_tupled2 ( u: u_ex) )
2526// CHECK: (1, 2)
2627
27- func sr11212_content_untupled_pattern_tupled3 ( u: Untupled ) -> ( Int , Int ) {
28+ func content_untupled_pattern_tupled3 ( u: Untupled ) -> ( Int , Int ) {
2829 switch u { case let . upair( ( x, y) ) : return ( x, y) }
2930}
30- print ( sr11212_content_untupled_pattern_tupled3 ( u: u_ex) )
31+ print ( content_untupled_pattern_tupled3 ( u: u_ex) )
3132// CHECK: (1, 2)
3233
33- func sr11212_content_untupled_pattern_untupled1 ( u: Untupled ) -> ( Int , Int ) {
34+ func content_untupled_pattern_untupled1 ( u: Untupled ) -> ( Int , Int ) {
3435 switch u { case . upair( let x, let y) : return ( x, y) }
3536}
36- print ( sr11212_content_untupled_pattern_untupled1 ( u: u_ex) )
37+ print ( content_untupled_pattern_untupled1 ( u: u_ex) )
3738// CHECK: (1, 2)
3839
39- func sr11212_content_untupled_pattern_untupled2 ( u: Untupled ) -> ( Int , Int ) {
40+ func content_untupled_pattern_untupled2 ( u: Untupled ) -> ( Int , Int ) {
4041 switch u { case let . upair( x, y) : return ( x, y) }
4142}
42- print ( sr11212_content_untupled_pattern_untupled2 ( u: u_ex) )
43+ print ( content_untupled_pattern_untupled2 ( u: u_ex) )
4344// CHECK: (1, 2)
4445
45- func sr11212_content_untupled_pattern_ambiguous1 ( u: Untupled ) -> ( Int , Int ) {
46+ func content_untupled_pattern_ambiguous1 ( u: Untupled ) -> ( Int , Int ) {
4647 switch u { case . upair( let u_) : return u_ }
4748}
48- print ( sr11212_content_untupled_pattern_ambiguous1 ( u: u_ex) )
49+ print ( content_untupled_pattern_ambiguous1 ( u: u_ex) )
4950// CHECK: (1, 2)
5051
51- func sr11212_content_untupled_pattern_ambiguous2 ( u: Untupled ) -> ( Int , Int ) {
52+ func content_untupled_pattern_ambiguous2 ( u: Untupled ) -> ( Int , Int ) {
5253 switch u { case let . upair( u_) : return u_ }
5354}
54- print ( sr11212_content_untupled_pattern_ambiguous2 ( u: u_ex) )
55+ print ( content_untupled_pattern_ambiguous2 ( u: u_ex) )
5556// CHECK: (1, 2)
5657
5758enum Tupled {
@@ -60,46 +61,46 @@ enum Tupled {
6061
6162let t_ex = Tupled . tpair ( ( 1 , 2 ) )
6263
63- func sr11212_content_tupled_pattern_tupled1 ( t: Tupled ) -> ( Int , Int ) {
64+ func content_tupled_pattern_tupled1 ( t: Tupled ) -> ( Int , Int ) {
6465 switch t { case . tpair( ( let x, let y) ) : return ( x, y) }
6566}
66- print ( sr11212_content_tupled_pattern_tupled1 ( t: t_ex) )
67+ print ( content_tupled_pattern_tupled1 ( t: t_ex) )
6768// CHECK: (1, 2)
6869
69- func sr11212_content_tupled_pattern_tupled2 ( t: Tupled ) -> ( Int , Int ) {
70+ func content_tupled_pattern_tupled2 ( t: Tupled ) -> ( Int , Int ) {
7071 switch t { case . tpair( let ( x, y) ) : return ( x, y) }
7172}
72- print ( sr11212_content_tupled_pattern_tupled2 ( t: t_ex) )
73+ print ( content_tupled_pattern_tupled2 ( t: t_ex) )
7374// CHECK: (1, 2)
7475
75- func sr11212_content_tupled_pattern_tupled3 ( t: Tupled ) -> ( Int , Int ) {
76+ func content_tupled_pattern_tupled3 ( t: Tupled ) -> ( Int , Int ) {
7677 switch t { case let . tpair( ( x, y) ) : return ( x, y) }
7778}
78- print ( sr11212_content_tupled_pattern_tupled3 ( t: t_ex) )
79+ print ( content_tupled_pattern_tupled3 ( t: t_ex) )
7980// CHECK: (1, 2)
8081
81- func sr11212_content_tupled_pattern_untupled1 ( t: Tupled ) -> ( Int , Int ) {
82+ func content_tupled_pattern_untupled1 ( t: Tupled ) -> ( Int , Int ) {
8283 switch t { case . tpair( let x, let y) : return ( x, y) }
8384}
84- print ( sr11212_content_tupled_pattern_untupled1 ( t: t_ex) )
85+ print ( content_tupled_pattern_untupled1 ( t: t_ex) )
8586// CHECK: (1, 2)
8687
87- func sr11212_content_tupled_pattern_untupled2 ( t: Tupled ) -> ( Int , Int ) {
88+ func content_tupled_pattern_untupled2 ( t: Tupled ) -> ( Int , Int ) {
8889 switch t { case let . tpair( x, y) : return ( x, y) }
8990}
90- print ( sr11212_content_tupled_pattern_untupled2 ( t: t_ex) )
91+ print ( content_tupled_pattern_untupled2 ( t: t_ex) )
9192// CHECK: (1, 2)
9293
93- func sr11212_content_tupled_pattern_ambiguous1 ( t: Tupled ) -> ( Int , Int ) {
94+ func content_tupled_pattern_ambiguous1 ( t: Tupled ) -> ( Int , Int ) {
9495 switch t { case . tpair( let t_) : return t_ }
9596}
96- print ( sr11212_content_tupled_pattern_ambiguous1 ( t: t_ex) )
97+ print ( content_tupled_pattern_ambiguous1 ( t: t_ex) )
9798// CHECK: (1, 2)
9899
99- func sr11212_content_tupled_pattern_ambiguous2 ( t: Tupled ) -> ( Int , Int ) {
100+ func content_tupled_pattern_ambiguous2 ( t: Tupled ) -> ( Int , Int ) {
100101 switch t { case let . tpair( t_) : return t_ }
101102}
102- print ( sr11212_content_tupled_pattern_ambiguous2 ( t: t_ex) )
103+ print ( content_tupled_pattern_ambiguous2 ( t: t_ex) )
103104// CHECK: (1, 2)
104105
105106enum Box < T> {
@@ -108,44 +109,44 @@ enum Box<T> {
108109
109110let b_ex : Box < ( Int , Int ) > = Box . box ( ( 1 , 2 ) )
110111
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 ) {
112113 switch b { case . box( ( let x, let y) ) : return ( x, y) }
113114}
114- print ( sr11212_content_generic_pattern_tupled1 ( b: b_ex) )
115+ print ( content_generic_pattern_tupled1 ( b: b_ex) )
115116// CHECK: (1, 2)
116117
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 ) {
118119 switch b { case . box( let ( x, y) ) : return ( x, y) }
119120}
120- print ( sr11212_content_generic_pattern_tupled2 ( b: b_ex) )
121+ print ( content_generic_pattern_tupled2 ( b: b_ex) )
121122// CHECK: (1, 2)
122123
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 ) {
124125 switch b { case let . box( ( x, y) ) : return ( x, y) }
125126}
126- print ( sr11212_content_generic_pattern_tupled3 ( b: b_ex) )
127+ print ( content_generic_pattern_tupled3 ( b: b_ex) )
127128// CHECK: (1, 2)
128129
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 ) {
130131 switch b { case . box( let x, let y) : return ( x, y) }
131132}
132- print ( sr11212_content_generic_pattern_untupled1 ( b: b_ex) )
133+ print ( content_generic_pattern_untupled1 ( b: b_ex) )
133134// CHECK: (1, 2)
134135
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 ) {
136137 switch b { case let . box( x, y) : return ( x, y) }
137138}
138- print ( sr11212_content_generic_pattern_untupled2 ( b: b_ex) )
139+ print ( content_generic_pattern_untupled2 ( b: b_ex) )
139140// CHECK: (1, 2)
140141
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 ) {
142143 switch b { case . box( let b_) : return b_ }
143144}
144- print ( sr11212_content_generic_pattern_ambiguous1 ( b: b_ex) )
145+ print ( content_generic_pattern_ambiguous1 ( b: b_ex) )
145146// CHECK: (1, 2)
146147
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 ) {
148149 switch b { case let . box( b_) : return b_ }
149150}
150- print ( sr11212_content_generic_pattern_ambiguous2 ( b: b_ex) )
151+ print ( content_generic_pattern_ambiguous2 ( b: b_ex) )
151152// CHECK: (1, 2)
0 commit comments