@@ -732,7 +732,7 @@ public struct ${Self}<Element>
732
732
get {
733
733
_checkIndex ( bounds. lowerBound)
734
734
_checkIndex ( bounds. upperBound)
735
- return ArraySlice ( _buffer [ bounds] )
735
+ return ArraySlice ( _buffer: _buffer [ bounds] )
736
736
}
737
737
set ( rhs) {
738
738
_checkIndex ( bounds. lowerBound)
@@ -884,10 +884,19 @@ public struct ${Self}<Element>
884
884
885
885
/// Initialization from an existing buffer does not have "array.init"
886
886
/// semantics because the caller may retain an alias to buffer.
887
- public init ( _ _buffer: _Buffer ) {
887
+ public init ( _buffer: _Buffer ) {
888
888
self . _buffer = _buffer
889
889
}
890
890
891
+ % if Self == 'ArraySlice':
892
+ // FIXME(ABI): SR-1873 this shim allows the below init(arrayLiteral:) to
893
+ // compile, but it goes through a general collection initializer instead of
894
+ // the expected efficient one for _SliceBuffer<Element> above.
895
+ public init ( _buffer: _ContiguousArrayBuffer < Element > ) {
896
+ self . init ( _buffer)
897
+ }
898
+ % end
899
+
891
900
public var _buffer : _Buffer
892
901
}
893
902
@@ -926,7 +935,7 @@ extension ${Self} : ArrayLiteralConvertible {
926
935
///
927
936
/// - Parameter elements: A variadic list of elements of the new array.
928
937
public init ( arrayLiteral elements: Element ... ) {
929
- self . init ( _extractOrCopyToNativeArrayBuffer ( elements. _buffer) )
938
+ self . init ( _buffer : _extractOrCopyToNativeArrayBuffer ( elements. _buffer) )
930
939
}
931
940
% end
932
941
}
@@ -1027,7 +1036,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
1027
1036
public init< S : Sequence> ( _ s: S)
1028
1037
where S. Iterator . Element == Element {
1029
1038
1030
- self = ${ Self} ( _Buffer ( s. _copyToNativeArrayBuffer ( ) ,
1039
+ self = ${ Self} ( _buffer : _Buffer ( s. _copyToNativeArrayBuffer ( ) ,
1031
1040
shiftedToStartIndex: 0 ) )
1032
1041
}
1033
1042
@@ -1114,7 +1123,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
1114
1123
storage, to: _ContiguousArrayStorage< Element> . self ) )
1115
1124
1116
1125
return (
1117
- Array ( _Buffer ( innerBuffer, shiftedToStartIndex: 0 ) ) ,
1126
+ Array ( _buffer : _Buffer ( innerBuffer, shiftedToStartIndex: 0 ) ) ,
1118
1127
innerBuffer. firstElementAddress)
1119
1128
}
1120
1129
@@ -2082,7 +2091,7 @@ public func != <Element : Equatable>(
2082
2091
public func _arrayUpCast< Derived, Base> ( _ a: Array < Derived > ) -> Array < Base > {
2083
2092
// FIXME: Dynamic casting is currently not possible without the objc runtime:
2084
2093
// rdar://problem/18801510
2085
- return Array ( a. _buffer. cast ( toBufferOf: Base . self) )
2094
+ return Array ( _buffer : a. _buffer. cast ( toBufferOf: Base . self) )
2086
2095
}
2087
2096
#endif
2088
2097
@@ -2113,7 +2122,7 @@ extension Array {
2113
2122
/// * `Element` is bridged verbatim to Objective-C (i.e.,
2114
2123
/// is a reference type).
2115
2124
public init ( _immutableCocoaArray: _NSArrayCore ) {
2116
- self = Array ( _ArrayBuffer ( nsArray: _immutableCocoaArray) )
2125
+ self = Array ( _buffer : _ArrayBuffer ( nsArray: _immutableCocoaArray) )
2117
2126
}
2118
2127
}
2119
2128
#endif
0 commit comments