[stdlib] Moving the Array.filter to _ArrayProtocol

Resolves ambiguity in the following expression

  _ = Array(0..<10).lazy.flatMap { .some($0) }.filter { _ in false }

Fixes: <rdar://problem/32316948>
This commit is contained in:
Max Moiseev
2017-05-23 17:32:23 -07:00
parent b3a6b852fc
commit 5590872b35
3 changed files with 17 additions and 10 deletions

View File

@@ -1574,16 +1574,6 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
}
}
// Since RangeReplaceableCollection now has a version of filter that is less
// efficient, we should make the default implementation coming from Sequence
// preferred.
@_inlineable
public func filter(
_ isIncluded: (Element) throws -> Bool
) rethrows -> [Element] {
return try _filter(isIncluded)
}
//===--- algorithms -----------------------------------------------------===//
@_inlineable