Skip to content

Commit 1d4f220

Browse files
[stdlib] Replace precondition with the internal _precondition
1 parent 137b2be commit 1d4f220

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

stdlib/public/core/Misc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func _mangledTypeName(_ type: Any.Type) -> String? {
8181
let (result, repairsMade) = String._fromUTF8Repairing(
8282
UnsafeBufferPointer(start: stringPtr, count: count))
8383

84-
precondition(!repairsMade, "repairs made to _mangledTypeName, this is not expected since names should be valid UTF-8")
84+
_precondition(!repairsMade, "repairs made to _mangledTypeName, this is not expected since names should be valid UTF-8")
8585

8686
return result
8787
}

stdlib/public/core/Sort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,6 @@ extension UnsafeMutableBufferPointer {
696696
}
697697

698698
// FIXME: Remove this, it works around rdar://problem/45044610
699-
precondition(result)
699+
_precondition(result)
700700
}
701701
}

stdlib/public/core/StringBridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private func getConstantTaggedCocoaContents(_ cocoaString: _CocoaString) ->
481481
let length = ivarPointer.pointee.length
482482
let isUTF16Mask:UInt = 0x0000_0000_0000_0004 //CFStringFlags bit 4: isUnicode
483483
let isASCII = ivarPointer.pointee.flags & isUTF16Mask == 0
484-
precondition(isASCII) // we don't currently support non-ASCII here
484+
_precondition(isASCII) // we don't currently support non-ASCII here
485485
let contentsPtr = ivarPointer.pointee.str
486486
return (
487487
utf16Length: Int(length),

stdlib/public/core/StringLegacy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension String {
2828
/// - count: The number of times to repeat `repeatedValue` in the resulting
2929
/// string.
3030
public init(repeating repeatedValue: String, count: Int) {
31-
precondition(count >= 0, "Negative count not allowed")
31+
_precondition(count >= 0, "Negative count not allowed")
3232
guard count > 1 else {
3333
self = count == 0 ? "" : repeatedValue
3434
return

stdlib/public/core/StringStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ extension __StringStorage {
445445

446446
// @opaque
447447
fileprivate var _breadcrumbsAddress: UnsafeMutablePointer<_StringBreadcrumbs?> {
448-
precondition(
448+
_precondition(
449449
hasBreadcrumbs, "Internal error: string breadcrumbs not present")
450450
return UnsafeMutablePointer(_realCapacityEnd)
451451
}

stdlib/public/core/StringUTF16View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ extension String.UTF16View: BidirectionalCollection {
158158

159159
@inlinable @inline(__always)
160160
public func index(before idx: Index) -> Index {
161-
precondition(!idx.isZeroPosition)
161+
_precondition(!idx.isZeroPosition)
162162
if _slowPath(_guts.isForeign) { return _foreignIndex(before: idx) }
163163
if _guts.isASCII { return idx.priorEncoded }
164164

stdlib/public/core/StringUTF8View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ extension String.UTF8View: BidirectionalCollection {
145145

146146
@inlinable @inline(__always)
147147
public func index(before i: Index) -> Index {
148-
precondition(!i.isZeroPosition)
148+
_precondition(!i.isZeroPosition)
149149
if _fastPath(_guts.isFastUTF8) {
150150
return i.strippingTranscoding.priorEncoded
151151
}

stdlib/public/core/StringUnicodeScalarView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ extension String.UnicodeScalarView: BidirectionalCollection {
129129
@inlinable @inline(__always)
130130
public func index(before i: Index) -> Index {
131131
let i = _guts.scalarAlign(i)
132-
precondition(i._encodedOffset > 0)
132+
_precondition(i._encodedOffset > 0)
133133
// TODO(String performance): isASCII fast-path
134134

135135
if _fastPath(_guts.isFastUTF8) {

0 commit comments

Comments
 (0)