@@ -1338,17 +1338,17 @@ do {
1338
1338
s. takesClosureTuple ( { _ = $0 } )
1339
1339
s. takesClosureTuple ( { x in } )
1340
1340
s. takesClosureTuple ( { ( x: ( Double , Double ) ) in } )
1341
- s. takesClosureTuple ( { _ = $0; _ = $1 } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring with implicit parameters}}
1342
- s. takesClosureTuple ( { ( x, y) in } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring}} {{25-31=(arg)}} {{34-34=let (x, y) = arg; }}
1343
- s. takesClosureTuple ( { ( x: Double , y: Double ) in } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring}} {{25-46=(arg: (Double, Double))}} {{49-49=let (x, y) = arg; }}
1341
+ s. takesClosureTuple ( { _ = $0; _ = $1 } )
1342
+ s. takesClosureTuple ( { ( x, y) in } )
1343
+ s. takesClosureTuple ( { ( x: Double , y: Double ) in } )
1344
1344
1345
1345
let sTwo = GenericConforms < ( Double , Double ) > ( )
1346
1346
sTwo. takesClosure ( { _ = $0 } )
1347
1347
sTwo. takesClosure ( { x in } )
1348
1348
sTwo. takesClosure ( { ( x: ( Double , Double ) ) in } )
1349
- sTwo. takesClosure ( { _ = $0; _ = $1 } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring with implicit parameters}}
1350
- sTwo. takesClosure ( { ( x, y) in } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring}} {{23-29=(arg)}} {{32-32=let (x, y) = arg; }}
1351
- sTwo. takesClosure ( { ( x: Double , y: Double ) in } ) // expected-error {{closure tuple parameter '(Double, Double)' does not support destructuring}} {{23-45=(arg: (Double, Double))}} {{48-48=let (x, y) = arg; }}
1349
+ sTwo. takesClosure ( { _ = $0; _ = $1 } )
1350
+ sTwo. takesClosure ( { ( x, y) in } )
1351
+ sTwo. takesClosure ( { ( x: Double , y: Double ) in } )
1352
1352
}
1353
1353
1354
1354
do {
@@ -1461,7 +1461,6 @@ let pages3: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = Muta
1461
1461
// SR-4745
1462
1462
let sr4745 = [ 1 , 2 ]
1463
1463
let _ = sr4745. enumerated ( ) . map { ( count, element) in " \( count) : \( element) " }
1464
- // expected-error@-1 {{closure tuple parameter '(offset: Int, element: Int)' does not support destructuring}} {{35-51=(arg) -> <#Result#>}} {{55-55=let (count, element) = arg; return }}
1465
1464
1466
1465
// SR-4738
1467
1466
@@ -1472,7 +1471,6 @@ let sr4738 = (1, (2, 3))
1472
1471
// rdar://problem/31892961
1473
1472
let r31892961_1 = [ 1 : 1 , 2 : 2 ]
1474
1473
r31892961_1. forEach { ( k, v) in print ( k + v) }
1475
- // expected-error@-1 {{closure tuple parameter '(key: Int, value: Int)' does not support destructuring}} {{23-29=(arg)}} {{33-33=let (k, v) = arg; }}
1476
1474
1477
1475
let r31892961_2 = [ 1 , 2 , 3 ]
1478
1476
let _: [ Int ] = r31892961_2. enumerated ( ) . map { ( ( index, val) ) in
@@ -1482,15 +1480,12 @@ let _: [Int] = r31892961_2.enumerated().map { ((index, val)) in
1482
1480
}
1483
1481
1484
1482
let r31892961_3 = ( x: 1 , y: 42 )
1485
- [ r31892961_3 ] . map { ( x: Int , y: Int ) in x + y }
1486
- // expected-error@-1 {{closure tuple parameter '(x: Int, y: Int)' does not support destructuring}} {{21-37=(arg: (x: Int, y: Int)) -> <#Result#>}} {{41-41=let (x, y) = arg; return }}
1483
+ _ = [ r31892961_3 ] . map { ( x: Int , y: Int ) in x + y }
1487
1484
1488
- [ r31892961_3 ] . map { ( x, y: Int ) in x + y }
1489
- // expected-error@-1 {{closure tuple parameter '(x: Int, y: Int)' does not support destructuring}} {{21-32=(arg: (x: Int, y: Int)) -> <#Result#>}} {{36-36=let (x, y) = arg; return }}
1485
+ _ = [ r31892961_3 ] . map { ( x, y: Int ) in x + y }
1490
1486
1491
1487
let r31892961_4 = ( 1 , 2 )
1492
- [ r31892961_4 ] . map { x, y in x + y }
1493
- // expected-error@-1 {{closure tuple parameter '(Int, Int)' does not support destructuring}} {{21-25=(arg) -> <#Result#>}} {{29-29=let (x, y) = arg; return }}
1488
+ _ = [ r31892961_4 ] . map { x, y in x + y }
1494
1489
1495
1490
let r31892961_5 = ( x: 1 , ( y: 2 , ( w: 3 , z: 4 ) ) )
1496
1491
[ r31892961_5 ] . map { ( x: Int, ( y: Int, ( w: Int, z: Int) ) ) in x + y }
@@ -1526,3 +1521,24 @@ rdar32301091_2 { _ in }
1526
1521
// expected-error@-1 {{contextual closure type '(Int, Int) -> ()' expects 2 arguments, but 1 was used in closure body}} {{19-19=,_ }}
1527
1522
rdar32301091_2 { x in }
1528
1523
// expected-error@-1 {{contextual closure type '(Int, Int) -> ()' expects 2 arguments, but 1 was used in closure body}} {{19-19=,<#arg#> }}
1524
+
1525
+ func rdar32875953( ) {
1526
+ let myDictionary = [ " hi " : 1 ]
1527
+
1528
+ myDictionary. forEach {
1529
+ print ( " \( $0) -> \( $1) " )
1530
+ }
1531
+
1532
+ myDictionary. forEach { key, value in
1533
+ print ( " \( key) -> \( value) " )
1534
+ }
1535
+
1536
+ myDictionary. forEach { ( key, value) in
1537
+ print ( " \( key) -> \( value) " )
1538
+ }
1539
+
1540
+ let array1 = [ 1 ]
1541
+ let array2 = [ 2 ]
1542
+
1543
+ _ = zip ( array1, array2) . map ( + )
1544
+ }
0 commit comments