File tree Expand file tree Collapse file tree 5 files changed +8
-8
lines changed
stdlib/public/SDK/Foundation Expand file tree Collapse file tree 5 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ extension String.UTF16View.Index {
15
15
@available ( swift, deprecated: 3.2 )
16
16
@available ( swift, obsoleted: 4.0 )
17
17
public init ( _ offset: Int ) {
18
- precondition ( offset >= 0 , " Negative UTF16 index offset not allowed " )
18
+ assert ( offset >= 0 , " Negative UTF16 index offset not allowed " )
19
19
self . init ( encodedOffset: offset)
20
20
}
21
21
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ extension Array : _ObjectiveCBridgeable {
31
31
/// The provided `NSArray` will be copied to ensure that the copy can
32
32
/// not be mutated by other code.
33
33
internal init ( _cocoaArray: NSArray ) {
34
- precondition ( _isBridgedVerbatimToObjectiveC ( Element . self) ,
34
+ assert ( _isBridgedVerbatimToObjectiveC ( Element . self) ,
35
35
" Array can be backed by NSArray only when the element type can be bridged verbatim to Objective-C " )
36
36
// FIXME: We would like to call CFArrayCreateCopy() to avoid doing an
37
37
// objc_msgSend() for instances of CoreFoundation types. We can't do that
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ extension Dictionary {
35
35
/// The provided `NSDictionary` will be copied to ensure that the copy can
36
36
/// not be mutated by other code.
37
37
public init ( _cocoaDictionary: _NSDictionary ) {
38
- precondition (
38
+ assert (
39
39
_isBridgedVerbatimToObjectiveC ( Key . self) &&
40
40
_isBridgedVerbatimToObjectiveC ( Value . self) ,
41
41
" Dictionary can be backed by NSDictionary storage only when both key and value are bridged verbatim to Objective-C " )
@@ -228,8 +228,8 @@ extension NSDictionary {
228
228
let alignment = MemoryLayout< AnyObject> . alignment
229
229
let singleSize = stride * numElems
230
230
let totalSize = singleSize * 2
231
- precondition ( stride == MemoryLayout< NSCopying> . stride)
232
- precondition ( alignment == MemoryLayout< NSCopying> . alignment)
231
+ assert ( stride == MemoryLayout< NSCopying> . stride)
232
+ assert ( alignment == MemoryLayout< NSCopying> . alignment)
233
233
234
234
// Allocate a buffer containing both the keys and values.
235
235
let buffer = UnsafeMutableRawPointer . allocate (
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ extension Set {
18
18
/// The provided `NSSet` will be copied to ensure that the copy can
19
19
/// not be mutated by other code.
20
20
public init ( _cocoaSet: _NSSet ) {
21
- precondition ( _isBridgedVerbatimToObjectiveC ( Element . self) ,
21
+ assert ( _isBridgedVerbatimToObjectiveC ( Element . self) ,
22
22
" Set can be backed by NSSet _variantStorage only when the member type can be bridged verbatim to Objective-C " )
23
23
// FIXME: We would like to call CFSetCreateCopy() to avoid doing an
24
24
// objc_msgSend() for instances of CoreFoundation types. We can't do that
Original file line number Diff line number Diff line change @@ -1637,7 +1637,7 @@ extension StringProtocol where Index == String.Index {
1637
1637
public func contains< T : StringProtocol > ( _ other: T ) -> Bool {
1638
1638
let r = self . range ( of: other) != nil
1639
1639
if #available( macOS 10 . 10 , iOS 8 . 0 , * ) {
1640
- precondition ( r == _ns. contains ( other. _ephemeralString) )
1640
+ assert ( r == _ns. contains ( other. _ephemeralString) )
1641
1641
}
1642
1642
return r
1643
1643
}
@@ -1660,7 +1660,7 @@ extension StringProtocol where Index == String.Index {
1660
1660
of: other, options: . caseInsensitive, locale: Locale . current
1661
1661
) != nil
1662
1662
if #available( macOS 10 . 10 , iOS 8 . 0 , * ) {
1663
- precondition ( r ==
1663
+ assert ( r ==
1664
1664
_ns. localizedCaseInsensitiveContains ( other. _ephemeralString) )
1665
1665
}
1666
1666
return r
You can’t perform that action at this time.
0 commit comments