@@ -175,7 +175,7 @@ internal class _AnySequenceBox<Element> {
175175 @inlinable
176176 internal func _map< T> (
177177 _ transform: ( Element ) throws -> T
178- ) rethrows -> [ T ] {
178+ ) throws -> [ T ] {
179179 _abstract ( )
180180 }
181181
@@ -525,8 +525,8 @@ internal final class _SequenceBox<S: Sequence>: _AnySequenceBox<S.Element> {
525525 @inlinable
526526 internal override func _map< T> (
527527 _ transform: ( Element ) throws -> T
528- ) rethrows -> [ T ] {
529- return try _base. map ( transform)
528+ ) throws -> [ T ] {
529+ try _base. map ( transform)
530530 }
531531 @inlinable
532532 internal override func _filter(
@@ -618,8 +618,8 @@ internal final class _CollectionBox<S: Collection>: _AnyCollectionBox<S.Element>
618618 @inlinable
619619 internal override func _map< T> (
620620 _ transform: ( Element ) throws -> T
621- ) rethrows -> [ T ] {
622- return try _base. map ( transform)
621+ ) throws -> [ T ] {
622+ try _base. map ( transform)
623623 }
624624 @inlinable
625625 internal override func _filter(
@@ -813,8 +813,8 @@ internal final class _BidirectionalCollectionBox<S: BidirectionalCollection>
813813 @inlinable
814814 internal override func _map< T> (
815815 _ transform: ( Element ) throws -> T
816- ) rethrows -> [ T ] {
817- return try _base. map ( transform)
816+ ) throws -> [ T ] {
817+ try _base. map ( transform)
818818 }
819819 @inlinable
820820 internal override func _filter(
@@ -1026,8 +1026,8 @@ internal final class _RandomAccessCollectionBox<S: RandomAccessCollection>
10261026 @inlinable
10271027 internal override func _map< T> (
10281028 _ transform: ( Element ) throws -> T
1029- ) rethrows -> [ T ] {
1030- return try _base. map ( transform)
1029+ ) throws -> [ T ] {
1030+ try _base. map ( transform)
10311031 }
10321032 @inlinable
10331033 internal override func _filter(
@@ -1303,10 +1303,26 @@ extension AnySequence {
13031303 }
13041304
13051305 @inlinable
1306- public func map< T> (
1306+ @_alwaysEmitIntoClient
1307+ public func map< T, E> (
1308+ _ transform: ( Element ) throws ( E ) -> T
1309+ ) throws ( E) -> [ T ] {
1310+ do {
1311+ return try _box. _map ( transform)
1312+ } catch {
1313+ throw error as! E
1314+ }
1315+ }
1316+
1317+ // ABI-only entrypoint for the rethrows version of map, which has been
1318+ // superseded by the typed-throws version. Expressed as "throws", which is
1319+ // ABI-compatible with "rethrows".
1320+ @usableFromInline
1321+ @_silgen_name ( " $ss11AnySequenceV3mapySayqd__Gqd__xKXEKlF " )
1322+ func __rethrows_map< T> (
13071323 _ transform: ( Element ) throws -> T
1308- ) rethrows -> [ T ] {
1309- return try _box . _map ( transform)
1324+ ) throws -> [ T ] {
1325+ try map ( transform)
13101326 }
13111327
13121328 @inlinable
@@ -1390,10 +1406,26 @@ extension AnyCollection {
13901406 }
13911407
13921408 @inlinable
1393- public func map< T> (
1409+ @_alwaysEmitIntoClient
1410+ public func map< T, E> (
1411+ _ transform: ( Element ) throws ( E ) -> T
1412+ ) throws ( E) -> [ T ] {
1413+ do {
1414+ return try _box. _map ( transform)
1415+ } catch {
1416+ throw error as! E
1417+ }
1418+ }
1419+
1420+ // ABI-only entrypoint for the rethrows version of map, which has been
1421+ // superseded by the typed-throws version. Expressed as "throws", which is
1422+ // ABI-compatible with "rethrows".
1423+ @usableFromInline
1424+ @_silgen_name ( " $ss13AnyCollectionV3mapySayqd__Gqd__xKXEKlF " )
1425+ func __rethrows_map< T> (
13941426 _ transform: ( Element ) throws -> T
1395- ) rethrows -> [ T ] {
1396- return try _box . _map ( transform)
1427+ ) throws -> [ T ] {
1428+ try map ( transform)
13971429 }
13981430
13991431 @inlinable
@@ -1483,10 +1515,26 @@ extension AnyBidirectionalCollection {
14831515 }
14841516
14851517 @inlinable
1486- public func map< T> (
1518+ @_alwaysEmitIntoClient
1519+ public func map< T, E> (
1520+ _ transform: ( Element ) throws ( E ) -> T
1521+ ) throws ( E) -> [ T ] {
1522+ do {
1523+ return try _box. _map ( transform)
1524+ } catch {
1525+ throw error as! E
1526+ }
1527+ }
1528+
1529+ // ABI-only entrypoint for the rethrows version of map, which has been
1530+ // superseded by the typed-throws version. Expressed as "throws", which is
1531+ // ABI-compatible with "rethrows".
1532+ @usableFromInline
1533+ @_silgen_name ( " $ss26AnyBidirectionalCollectionV3mapySayqd__Gqd__xKXEKlF " )
1534+ func __rethrows_map< T> (
14871535 _ transform: ( Element ) throws -> T
1488- ) rethrows -> [ T ] {
1489- return try _box . _map ( transform)
1536+ ) throws -> [ T ] {
1537+ try map ( transform)
14901538 }
14911539
14921540 @inlinable
@@ -1578,10 +1626,26 @@ extension AnyRandomAccessCollection {
15781626 }
15791627
15801628 @inlinable
1581- public func map< T> (
1629+ @_alwaysEmitIntoClient
1630+ public func map< T, E> (
1631+ _ transform: ( Element ) throws ( E ) -> T
1632+ ) throws ( E) -> [ T ] {
1633+ do {
1634+ return try _box. _map ( transform)
1635+ } catch {
1636+ throw error as! E
1637+ }
1638+ }
1639+
1640+ // ABI-only entrypoint for the rethrows version of map, which has been
1641+ // superseded by the typed-throws version. Expressed as "throws", which is
1642+ // ABI-compatible with "rethrows".
1643+ @usableFromInline
1644+ @_silgen_name ( " $ss25AnyRandomAccessCollectionV3mapySayqd__Gqd__xKXEKlF " )
1645+ func __rethrows_map< T> (
15821646 _ transform: ( Element ) throws -> T
1583- ) rethrows -> [ T ] {
1584- return try _box . _map ( transform)
1647+ ) throws -> [ T ] {
1648+ try map ( transform)
15851649 }
15861650
15871651 @inlinable
0 commit comments