Skip to content

Commit b78bd2e

Browse files
authored
Merge pull request #31911 from valeriyvan/FixRangeReplaceableCollectionFilter
[SR-12648] Fixes filter function of RangeReplaceableCollection.
2 parents 5ec1e3e + a0b6517 commit b78bd2e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/core/RangeReplaceableCollection.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,11 @@ extension RangeReplaceableCollection {
10821082
public __consuming func filter(
10831083
_ isIncluded: (Element) throws -> Bool
10841084
) rethrows -> Self {
1085-
return try Self(self.lazy.filter(isIncluded))
1085+
var result = Self()
1086+
for element in self where try isIncluded(element) {
1087+
result.append(element)
1088+
}
1089+
return result
10861090
}
10871091
}
10881092

0 commit comments

Comments
 (0)