[stdlib] Add post-nil guarantee for IteratorProtocol.next() to always return nil

This commit is contained in:
Patrick Pijnappel
2016-03-16 22:06:07 +11:00
parent 149fd438a1
commit 020841d4ba
14 changed files with 40 additions and 57 deletions

View File

@@ -162,11 +162,8 @@ extension String {
}
}
/// Advance to the next element and return it, or `nil` if no next
/// element exists.
///
/// - Precondition: No preceding call to `self.next()` has returned
/// `nil`.
/// Advance to the next element and return it, or `nil` if no next element
/// exists. Once `nil` has been returned, all subsequent calls return `nil`.
public mutating func next() -> UnicodeScalar? {
var result: UnicodeDecodingResult
if _baseSet {