@@ -1222,89 +1222,147 @@ enum SR11212Tests {
1222
1222
case upair( Int , Int )
1223
1223
}
1224
1224
1225
- func sr11212_content_untupled_pattern_tupled ( u: Untupled ) -> ( Int , Int ) {
1225
+ func sr11212_content_untupled_pattern_tupled1 ( u: Untupled ) -> ( Int , Int ) {
1226
1226
switch u {
1227
1227
case . upair( ( let x, let y) ) : return ( x, y)
1228
1228
// expected-warning@-1 {{a tuple pattern cannot match several associated values at once, implicitly tupling the associated values and trying to match that instead}}
1229
1229
}
1230
1230
}
1231
1231
1232
- func sr11212_content_untupled_pattern_tupled_nested ( u: Untupled ) -> ( Int , Int ) {
1232
+ func sr11212_content_untupled_pattern_tupled2 ( u: Untupled ) -> ( Int , Int ) {
1233
1233
switch u {
1234
1234
case . upair( let ( x, y) ) : return ( x, y)
1235
1235
// expected-warning@-1 {{a tuple pattern cannot match several associated values at once, implicitly tupling the associated values and trying to match that instead}}
1236
1236
}
1237
1237
}
1238
1238
1239
- func sr11212_content_untupled_pattern_untupled( u: Untupled ) -> ( Int , Int ) {
1239
+ func sr11212_content_untupled_pattern_tupled3( u: Untupled ) -> ( Int , Int ) {
1240
+ switch u {
1241
+ case let . upair( ( x, y) ) : return ( x, y)
1242
+ // expected-warning@-1 {{a tuple pattern cannot match several associated values at once, implicitly tupling the associated values and trying to match that instead}}
1243
+ }
1244
+ }
1245
+
1246
+ func sr11212_content_untupled_pattern_untupled1( u: Untupled ) -> ( Int , Int ) {
1240
1247
switch u {
1241
1248
case . upair( let x, let y) : return ( x, y)
1242
1249
}
1243
1250
}
1244
1251
1245
- func sr11212_content_untupled_pattern_ambiguous( u: Untupled ) -> ( Int , Int ) {
1252
+ func sr11212_content_untupled_pattern_untupled2( u: Untupled ) -> ( Int , Int ) {
1253
+ switch u {
1254
+ case let . upair( x, y) : return ( x, y)
1255
+ }
1256
+ }
1257
+
1258
+ func sr11212_content_untupled_pattern_ambiguous1( u: Untupled ) -> ( Int , Int ) {
1246
1259
switch u {
1247
1260
case . upair( let u_) : return u_
1248
1261
// expected-warning@-1 {{cannot match several associated values at once, implicitly tupling the associated values and trying to match that instead}}
1249
1262
}
1250
1263
}
1251
1264
1265
+ func sr11212_content_untupled_pattern_ambiguous2( u: Untupled ) -> ( Int , Int ) {
1266
+ switch u {
1267
+ case let . upair( u_) : return u_
1268
+ // expected-warning@-1 {{cannot match several associated values at once, implicitly tupling the associated values and trying to match that instead}}
1269
+ }
1270
+ }
1271
+
1252
1272
enum Tupled {
1253
1273
case tpair( ( Int , Int ) )
1254
1274
}
1255
1275
1256
- func sr11212_content_tupled_pattern_tupled ( t: Tupled ) -> ( Int , Int ) {
1276
+ func sr11212_content_tupled_pattern_tupled1 ( t: Tupled ) -> ( Int , Int ) {
1257
1277
switch t {
1258
1278
case . tpair( ( let x, let y) ) : return ( x, y)
1259
1279
}
1260
1280
}
1261
1281
1262
- func sr11212_content_tupled_pattern_tupled_nested ( t: Tupled ) -> ( Int , Int ) {
1282
+ func sr11212_content_tupled_pattern_tupled2 ( t: Tupled ) -> ( Int , Int ) {
1263
1283
switch t {
1264
1284
case . tpair( let ( x, y) ) : return ( x, y)
1265
1285
}
1266
1286
}
1267
1287
1268
- func sr11212_content_tupled_pattern_untupled( t: Tupled ) -> ( Int , Int ) {
1288
+ func sr11212_content_tupled_pattern_tupled3( t: Tupled ) -> ( Int , Int ) {
1289
+ switch t {
1290
+ case let . tpair( ( x, y) ) : return ( x, y)
1291
+ }
1292
+ }
1293
+
1294
+ func sr11212_content_tupled_pattern_untupled1( t: Tupled ) -> ( Int , Int ) {
1269
1295
switch t {
1270
1296
case . tpair( let x, let y) : return ( x, y)
1271
1297
// expected-warning@-1 {{the enum case has a single tuple as an associated value, but there are several patterns here, implicitly tupling the patterns and trying to match that instead}}
1272
1298
}
1273
1299
}
1274
1300
1275
- func sr11212_content_tupled_pattern_ambiguous( t: Tupled ) -> ( Int , Int ) {
1301
+ func sr11212_content_tupled_pattern_untupled2( t: Tupled ) -> ( Int , Int ) {
1302
+ switch t {
1303
+ case let . tpair( x, y) : return ( x, y)
1304
+ // expected-warning@-1 {{the enum case has a single tuple as an associated value, but there are several patterns here, implicitly tupling the patterns and trying to match that instead}}
1305
+ }
1306
+ }
1307
+
1308
+ func sr11212_content_tupled_pattern_ambiguous1( t: Tupled ) -> ( Int , Int ) {
1276
1309
switch t {
1277
1310
case . tpair( let t_) : return t_
1278
1311
}
1279
1312
}
1280
1313
1314
+ func sr11212_content_tupled_pattern_ambiguous2( t: Tupled ) -> ( Int , Int ) {
1315
+ switch t {
1316
+ case let . tpair( t_) : return t_
1317
+ }
1318
+ }
1319
+
1281
1320
enum Box < T> {
1282
1321
case box( T )
1283
1322
}
1284
1323
1285
- func sr11212_content_generic_pattern_tupled ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1324
+ func sr11212_content_generic_pattern_tupled1 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1286
1325
switch b {
1287
1326
case . box( ( let x, let y) ) : return ( x, y)
1288
1327
}
1289
1328
}
1290
1329
1291
- func sr11212_content_generic_pattern_tupled_nested ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1330
+ func sr11212_content_generic_pattern_tupled2 ( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1292
1331
switch b {
1293
1332
case . box( let ( x, y) ) : return ( x, y)
1294
1333
}
1295
1334
}
1296
1335
1297
- func sr11212_content_generic_pattern_untupled( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1336
+ func sr11212_content_generic_pattern_tupled3( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1337
+ switch b {
1338
+ case let . box( ( x, y) ) : return ( x, y)
1339
+ }
1340
+ }
1341
+
1342
+ func sr11212_content_generic_pattern_untupled1( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1298
1343
switch b {
1299
1344
case . box( let x, let y) : return ( x, y)
1300
1345
// expected-warning@-1 {{the enum case has a single tuple as an associated value, but there are several patterns here, implicitly tupling the patterns and trying to match that instead}}
1301
1346
}
1302
1347
}
1303
1348
1304
- func sr11212_content_generic_pattern_ambiguous( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1349
+ func sr11212_content_generic_pattern_untupled2( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1350
+ switch b {
1351
+ case let . box( x, y) : return ( x, y)
1352
+ // expected-warning@-1 {{the enum case has a single tuple as an associated value, but there are several patterns here, implicitly tupling the patterns and trying to match that instead}}
1353
+ }
1354
+ }
1355
+
1356
+ func sr11212_content_generic_pattern_ambiguous1( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1305
1357
switch b {
1306
1358
case . box( let b_) : return b_
1307
1359
}
1308
1360
}
1309
1361
1362
+ func sr11212_content_generic_pattern_ambiguous2( b: Box < ( Int , Int ) > ) -> ( Int , Int ) {
1363
+ switch b {
1364
+ case let . box( b_) : return b_
1365
+ }
1366
+ }
1367
+
1310
1368
} // end SR11212Tests
0 commit comments