Skip to content

Commit a0b6517

Browse files
committed
Fixes filter function of RangeReplaceableCollection. Addresses ticket SR-12648
1 parent 84ff38f commit a0b6517

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)