[stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)

* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
This commit is contained in:
Ben Cohen
2017-05-14 06:33:25 -07:00
committed by GitHub
parent 2e275e3a13
commit ea2f64cad2
78 changed files with 503 additions and 500 deletions

View File

@@ -389,7 +389,7 @@ extension String.UnicodeScalarView : RangeReplaceableCollection {
///
/// - Complexity: O(*n*), where *n* is the length of the resulting view.
public mutating func append<S : Sequence>(contentsOf newElements: S)
where S.Iterator.Element == Unicode.Scalar {
where S.Element == Unicode.Scalar {
_core.append(contentsOf: newElements.lazy.flatMap { $0.utf16 })
}
@@ -411,7 +411,7 @@ extension String.UnicodeScalarView : RangeReplaceableCollection {
public mutating func replaceSubrange<C>(
_ bounds: Range<Index>,
with newElements: C
) where C : Collection, C.Iterator.Element == Unicode.Scalar {
) where C : Collection, C.Element == Unicode.Scalar {
let rawSubRange: Range<Int> = _toCoreIndex(bounds.lowerBound) ..<
_toCoreIndex(bounds.upperBound)
let lazyUTF16 = newElements.lazy.flatMap { $0.utf16 }