mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Conditional conformances for LazyMapCollection
(cherry picked from commit b927254564)
This commit is contained in:
@@ -95,8 +95,7 @@ extension LazyCollectionProtocol {
|
||||
extension LazyCollectionProtocol
|
||||
where
|
||||
Self : BidirectionalCollection,
|
||||
Elements : BidirectionalCollection
|
||||
{
|
||||
Elements : BidirectionalCollection {
|
||||
/// Returns the concatenated results of mapping the given transformation over
|
||||
/// this collection.
|
||||
///
|
||||
@@ -111,7 +110,7 @@ extension LazyCollectionProtocol
|
||||
_ transform: @escaping (Elements.Element) -> SegmentOfResult
|
||||
) -> LazyCollection<
|
||||
FlattenBidirectionalCollection<
|
||||
LazyMapBidirectionalCollection<Elements, SegmentOfResult>>> {
|
||||
LazyMapCollection<Elements, SegmentOfResult>>> {
|
||||
return self.map(transform).joined()
|
||||
}
|
||||
|
||||
@@ -128,9 +127,9 @@ extension LazyCollectionProtocol
|
||||
@_inlineable // FIXME(sil-serialize-all)
|
||||
public func flatMap<ElementOfResult>(
|
||||
_ transform: @escaping (Elements.Element) -> ElementOfResult?
|
||||
) -> LazyMapBidirectionalCollection<
|
||||
) -> LazyMapCollection<
|
||||
LazyFilterCollection<
|
||||
LazyMapBidirectionalCollection<Elements, ElementOfResult?>>,
|
||||
LazyMapCollection<Elements, ElementOfResult?>>,
|
||||
ElementOfResult
|
||||
> {
|
||||
return self.map(transform).filter { $0 != nil }.map { $0! }
|
||||
|
||||
Reference in New Issue
Block a user