Skip to content

Commit 5fdf107

Browse files
Restore Sequence conformance to FlattenSequence.Iterator (#18027)
1 parent e325e32 commit 5fdf107

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

stdlib/public/core/Flatten.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ extension FlattenSequence.Iterator: IteratorProtocol {
8585
}
8686
}
8787

88+
extension FlattenSequence.Iterator: Sequence { }
89+
8890
extension FlattenSequence: Sequence {
8991
/// Returns an iterator over the elements of this sequence.
9092
///

validation-test/stdlib/Collection/FlattenCollection.swift.gyb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ tests.test("FlattenCollection instances (${traversal}${kind})") {
6666
do {
6767
let expected = ["apple", "orange", "banana", "grapefruit", "lychee"]
6868
let base = [["apple", "orange"], ["banana", "grapefruit"], ["lychee"]]
69+
let flattened = Minimal${traversal}${kind}(elements: base).joined()
6970
check${traversal}${kind}(
7071
expected,
7172
Minimal${traversal}${kind}(elements: base).joined(),
7273
sameValue: { $0 == $1 })
74+
checkSequence(
75+
expected,
76+
flattened.makeIterator(),
77+
sameValue: { $0 == $1 })
7378
}
7479
}
7580
% end

0 commit comments

Comments
 (0)