@@ -786,7 +786,8 @@ public struct ${Self}<Element>
786786 buffer. _copyContents (
787787 subRange: Range ( buffer. indices) ,
788788 initializing: newBuffer. firstElementAddress)
789- buffer = _Buffer ( newBuffer, shiftedToStartIndex: buffer. startIndex)
789+ buffer = _Buffer (
790+ _buffer: newBuffer, shiftedToStartIndex: buffer. startIndex)
790791 }
791792
792793 @_semantics ( " array.make_mutable " )
@@ -885,8 +886,8 @@ public struct ${Self}<Element>
885886 /// Initialization from an existing buffer does not have "array.init"
886887 /// semantics because the caller may retain an alias to buffer.
887888 public // @testable
888- init ( _buffer: _ContiguousArrayBuffer < Element > ) {
889- self . init ( _buffer: _Buffer ( _buffer, shiftedToStartIndex: 0 ) )
889+ init ( _buffer buffer : _ContiguousArrayBuffer < Element > ) {
890+ self . init ( _buffer: _Buffer ( _buffer: buffer , shiftedToStartIndex: 0 ) )
890891 }
891892% end
892893
@@ -1031,7 +1032,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
10311032
10321033 self = ${ Self} (
10331034 _buffer: _Buffer (
1034- s. _copyToContiguousArray ( ) . _buffer,
1035+ _buffer : s. _copyToContiguousArray ( ) . _buffer,
10351036 shiftedToStartIndex: 0 ) )
10361037 }
10371038
@@ -1065,7 +1066,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
10651066 ) -> _Buffer {
10661067 let newBuffer = _ContiguousArrayBuffer < Element > (
10671068 uninitializedCount: 0 , minimumCapacity: minimumCapacity)
1068- return _Buffer ( newBuffer, shiftedToStartIndex: 0 )
1069+ return _Buffer ( _buffer : newBuffer, shiftedToStartIndex: 0 )
10691070 }
10701071
10711072 /// Construct a ${Self} of `count` uninitialized elements.
@@ -1118,7 +1119,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
11181119 storage, to: _ContiguousArrayStorage< Element> . self ) )
11191120
11201121 return (
1121- Array ( _buffer: _Buffer ( innerBuffer, shiftedToStartIndex: 0 ) ) ,
1122+ Array (
1123+ _buffer: _Buffer ( _buffer: innerBuffer, shiftedToStartIndex: 0 ) ) ,
11221124 innerBuffer. firstElementAddress)
11231125 }
11241126
@@ -1203,7 +1205,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
12031205 _buffer. _copyContents (
12041206 subRange: Range ( _buffer. indices) ,
12051207 initializing: newBuffer. firstElementAddress)
1206- _buffer = _Buffer ( newBuffer, shiftedToStartIndex: _buffer. startIndex)
1208+ _buffer = _Buffer (
1209+ _buffer: newBuffer, shiftedToStartIndex: _buffer. startIndex)
12071210 }
12081211 _sanityCheck ( capacity >= minimumCapacity)
12091212 }
@@ -1933,7 +1936,7 @@ internal func _arrayOutOfPlaceUpdate<_Buffer, Initializer>(
19331936 let tailEnd = source. endIndex
19341937 source. _copyContents ( subRange: tailStart..< tailEnd, initializing: newEnd)
19351938 }
1936- source = _Buffer ( dest, shiftedToStartIndex: source. startIndex)
1939+ source = _Buffer ( _buffer : dest, shiftedToStartIndex: source. startIndex)
19371940}
19381941
19391942internal struct _InitializePointer < T> : _PointerFunction {
@@ -2091,6 +2094,11 @@ public func != <Element : Equatable>(
20912094
20922095#if _runtime(_ObjC)
20932096extension Array {
2097+ public // @SPI(Foundation)
2098+ func _bridgeToObjectiveCImpl( ) -> AnyObject {
2099+ return _buffer. _asCocoaArray ( )
2100+ }
2101+
20942102 /// Tries to downcast the source `NSArray` as our native buffer type.
20952103 /// If it succeeds, creates a new `Array` around it and returns that.
20962104 /// Returns `nil` otherwise.
@@ -2154,7 +2162,7 @@ extension ArraySlice {
21542162 init ( _startIndex: Int ) {
21552163 self . init (
21562164 _buffer: _Buffer (
2157- ContiguousArray ( ) . _buffer,
2165+ _buffer : ContiguousArray ( ) . _buffer,
21582166 shiftedToStartIndex: _startIndex) )
21592167 }
21602168}
0 commit comments