@@ -229,10 +229,11 @@ if True:
229
229
/// array's first and last elements. If the array is empty, these properties
230
230
/// are `nil`.
231
231
///
232
- /// print(oddNumbers.first, oddNumbers.last, separator=", ")
232
+ /// if let firstElement = oddNumbers.first, lastElement = oddNumbers.last {
233
+ /// print(firstElement, lastElement, separator: ", ", terminator: "\n")
233
234
/// // Prints "1, 15"
234
235
///
235
- /// print(emptyDoubles.first, emptyDoubles.last, separator= ", ")
236
+ /// print(emptyDoubles.first, emptyDoubles.last, separator: ", ", terminator: "\n ")
236
237
/// // Prints "nil, nil"
237
238
///
238
239
/// You can access individual array elements through a subscript. The first
@@ -241,7 +242,7 @@ if True:
241
242
/// the count of the array. Using a negative number or an index equal to or
242
243
/// greater than `count` triggers a runtime error. For example:
243
244
///
244
- /// print(oddNumbers[0], oddNumbers[3], separator= ", ")
245
+ /// print(oddNumbers[0], oddNumbers[3], separator: ", ", terminator: "\n ")
245
246
/// // Prints "1, 7"
246
247
///
247
248
/// print(emptyDoubles[0])
@@ -619,10 +620,10 @@ ${SubscriptDocComment}
619
620
public subscript( index: Int) - > Element {
620
621
get {
621
622
// This call may be hoisted or eliminated by the optimizer. If
622
- // there is an inout violation, this value may be stale so needs to be
623
+ // there is an inout violation, this value may be stale so needs to be
623
624
// checked again below.
624
625
let wasNativeTypeChecked = _hoistableIsNativeTypeChecked ( )
625
-
626
+
626
627
// Make sure the index is in range and wasNativeTypeChecked is
627
628
// still valid.
628
629
let token = _checkSubscript (
@@ -634,7 +635,7 @@ ${SubscriptDocComment}
634
635
}
635
636
mutableAddressWithPinnedNativeOwner {
636
637
_makeMutableAndUniqueOrPinned ( ) // makes the array native, too
637
- _checkSubscript_native ( index)
638
+ _checkSubscript_native ( index)
638
639
return ( _getElementAddress ( index) , Builtin . tryPin ( _getOwner_native ( ) ) )
639
640
}
640
641
}
@@ -750,7 +751,7 @@ ${SubscriptDocComment}
750
751
// We are hiding the access to '_buffer.owner' behind
751
752
// _getOwner() to help the compiler hoist uniqueness checks in
752
753
// the case of class or Objective-C existential typed array
753
- // elements.
754
+ // elements.
754
755
return _getOwnerWithSemanticLabel_native ( )
755
756
}
756
757
#endif
@@ -990,12 +991,12 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
990
991
/// func cacheImagesWithNames(names: [String]) {
991
992
/// // custom image loading and caching
992
993
/// }
993
- ///
994
+ ///
994
995
/// let namedHues: [String: Int] = ["Vermillion": 18, "Magenta": 302,
995
996
/// "Gold": 50, "Cerise": 320]
996
997
/// let colorNames = Array(namedHues.keys)
997
998
/// cacheImagesWithNames(colorNames)
998
- ///
999
+ ///
999
1000
/// print(colorNames)
1000
1001
/// // Prints "["Gold", "Cerise", "Magenta", "Vermillion"]"
1001
1002
///
@@ -1082,15 +1083,15 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
1082
1083
internal static func _ado ptStorage(
1083
1084
_ storage: AnyObject, count: Int
1084
1085
) - > ( Array, UnsafeMutablePointer < Element > ) {
1085
-
1086
+
1086
1087
_sanityCheck (
1087
1088
storage is _ContiguousArrayStorage < Element > , " Invalid array storage type " )
1088
-
1089
+
1089
1090
let innerBuffer = _ContiguousArrayBuffer < Element > (
1090
1091
count: count,
1091
1092
storage: unsafeDowncast (
1092
1093
storage, to: _ContiguousArrayStorage< Element> . self ) )
1093
-
1094
+
1094
1095
return (
1095
1096
Array ( _Buffer ( innerBuffer, shiftedToStartIndex: 0 ) ) ,
1096
1097
innerBuffer. firstElementAddress)
0 commit comments