Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions stdlib/public/core/Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,6 @@ internal class _PrefixSequence<Base : IteratorProtocol>
maxLength: Swift.min(maxLength, self._maxLength),
taken: _taken))
}

internal func drop(
while predicate: (Base.Element) throws -> Bool
) rethrows -> AnySequence<Base.Element> {
return try AnySequence(
_DropWhileSequence(
iterator: _iterator, nextElement: nil, predicate: predicate))
}
}

/// A sequence that lazily consumes and drops `n` elements from an underlying
Expand Down
5 changes: 5 additions & 0 deletions validation-test/stdlib/SequenceType.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,11 @@ SequenceTypeTests.test("prefix/dispatch") {
expectCustomizable(tester, tester.log.prefixMaxLength)
}

SequenceTypeTests.test("prefix/drop/dispatch") {
let xs = sequence(first: 1, next: {$0 < 10 ? $0 + 1 : nil})
expectEqualSequence([], Array(xs.prefix(3).drop(while: {$0 < 7})))
}

//===----------------------------------------------------------------------===//
// prefix(while:)
//===----------------------------------------------------------------------===//
Expand Down