Skip to content

Commit 1186fc7

Browse files
committed
Remove "iff" from doc comments.
This abbreviation for "if and only if" is confusing to those not coming from a background in formal mathematics, and is frequently reported as a type by developers reading the documentation. This commit also changes doc comments in internal and private members, which don't become part of the public documentation, because omitting "iff" everywhere makes it much easier to check for any later changes that reintroduce it.
1 parent 94d824a commit 1186fc7

11 files changed

+41
-31
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ extension _ArrayBuffer {
9797
return _isNativeTypeChecked
9898
}
9999

100-
/// Returns `true` iff this buffer's storage is uniquely-referenced.
100+
/// Returns `true` if this buffer's storage is uniquely referenced;
101+
/// otherwise, returns `false`.
101102
///
102103
/// This function should only be used for internal sanity checks.
103104
/// To guard a buffer mutation, use `beginCOWMutation`.
@@ -109,8 +110,9 @@ extension _ArrayBuffer {
109110
return _storage.isUniquelyReferencedNative()
110111
}
111112

112-
/// Returns `true` and puts the buffer in a mutable state iff the buffer's
113-
/// storage is uniquely-referenced.
113+
/// Returns `true` and puts the buffer in a mutable state if the buffer's
114+
/// storage is uniquely-referenced; otherwise performs no action and
115+
/// returns `false`.
114116
///
115117
/// - Precondition: The buffer must be immutable.
116118
///

stdlib/public/core/ArrayBufferProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ where Indices == Range<Int> {
4949
minimumCapacity: Int
5050
) -> _ContiguousArrayBuffer<Element>?
5151

52-
/// Returns `true` iff this buffer is backed by a uniquely-referenced mutable
53-
/// _ContiguousArrayBuffer.
52+
/// Returns `true` if this buffer is backed by a uniquely-referenced mutable
53+
/// _ContiguousArrayBuffer; otherwise, returns `false`.
5454
///
5555
/// - Note: This function must remain mutating; otherwise the buffer
5656
/// may acquire spurious extra references, which will cause

stdlib/public/core/Builtin.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ internal func _conditionallyUnreachable() -> Never {
182182
@_silgen_name("_swift_isClassOrObjCExistentialType")
183183
internal func _swift_isClassOrObjCExistentialType<T>(_ x: T.Type) -> Bool
184184

185-
/// Returns `true` iff `T` is a class type or an `@objc` existential such as
186-
/// `AnyObject`.
185+
/// Returns `true` if `T` is a class type or an `@objc` existential such as
186+
/// `AnyObject`; otherwise, returns `false`.
187187
@inlinable
188188
@inline(__always)
189189
internal func _isClassOrObjCExistential<T>(_ x: T.Type) -> Bool {
@@ -303,8 +303,8 @@ func _uncheckedUnsafeAssume(_ condition: Bool) {
303303

304304
//===--- Runtime shim wrappers --------------------------------------------===//
305305

306-
/// Returns `true` iff the class indicated by `theClass` uses native
307-
/// Swift reference-counting.
306+
/// Returns `true` if the class indicated by `theClass` uses native
307+
/// Swift reference-counting; otherwise, returns `false`.
308308
#if _runtime(_ObjC)
309309
// Declare it here instead of RuntimeShims.h, because we need to specify
310310
// the type of argument to be AnyClass. This is currently not possible

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
668668
}
669669
}
670670

671-
/// Returns `true` iff this buffer's storage is uniquely-referenced.
671+
/// Returns `true` if this buffer's storage is uniquely-referenced;
672+
/// otherwise, returns `false`.
672673
///
673674
/// This function should only be used for internal sanity checks.
674675
/// To guard a buffer mutation, use `beginCOWMutation`.
@@ -677,8 +678,9 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
677678
return _isUnique(&_storage)
678679
}
679680

680-
/// Returns `true` and puts the buffer in a mutable state iff the buffer's
681-
/// storage is uniquely-referenced.
681+
/// Returns `true` and puts the buffer in a mutable state if the buffer's
682+
/// storage is uniquely-referenced; otherwise, performs no action and returns
683+
/// `false`.
682684
///
683685
/// - Precondition: The buffer must be immutable.
684686
///
@@ -817,7 +819,7 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
817819
return UnsafeRawPointer(firstElementAddress)
818820
}
819821

820-
/// Returns `true` iff we have storage for elements of the given
822+
/// Returns `true` if we have storage for elements of the given
821823
/// `proposedElementType`. If not, we'll be treated as immutable.
822824
@inlinable
823825
func canStoreElements(ofDynamicType proposedElementType: Any.Type) -> Bool {

stdlib/public/core/DictionaryBuilder.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ extension Dictionary {
5555
/// initialized and the elements in the range `c..<capacity` are
5656
/// uninitialized.
5757
///
58-
/// The resulting dictionary has a `count` less than or equal to `c`. The
59-
/// actual count is less iff some of the initialized keys were duplicates.
60-
/// (This cannot happen if `allowingDuplicates` is false.)
58+
/// The resulting dictionary has a `count` less than or equal to `c`.
59+
/// If some of the initialized keys were duplicates, the actual count is less.
60+
/// This cannot happen for any other reasons or if `allowingDuplicates` is false.
6161
///
6262
/// The buffers passed to the closure are only valid for the duration of the
6363
/// call. After the closure returns, this initializer moves all initialized

stdlib/public/core/FloatingPointParsing.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ cFuncSuffix2 = {16: 'f16', 32: 'f', 64: 'd', 80: 'ld'}
3030

3131
}%
3232

33-
/// Returns `true` iff isspace(u) would return nonzero when the current
34-
/// locale is the C locale.
33+
/// Returns `true` if isspace(u) would return nonzero when the current
34+
/// locale is the C locale; otherwise, returns false.
3535
@inlinable // FIXME(sil-serialize-all)
3636
internal func _isspace_clocale(_ u: UTF16.CodeUnit) -> Bool {
3737
return "\t\n\u{b}\u{c}\r ".utf16.contains(u)

stdlib/public/core/NativeDictionary.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ extension _NativeDictionary { // ensureUnique
245245
}
246246

247247
/// Ensure storage of self is uniquely held and can hold at least `capacity`
248-
/// elements. Returns true iff contents were rehashed.
248+
/// elements.
249+
///
250+
/// -Returns: `true` if contents were rehashed; otherwise, `false`.
249251
@inlinable
250252
@_semantics("optimize.sil.specialize.generic.size.never")
251253
internal mutating func ensureUnique(isUnique: Bool, capacity: Int) -> Bool {

stdlib/public/core/NativeSet.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ extension _NativeSet { // ensureUnique
224224
}
225225

226226
/// Ensure storage of self is uniquely held and can hold at least `capacity`
227-
/// elements. Returns true iff contents were rehashed.
227+
/// elements.
228+
///
229+
/// -Returns: `true` if contents were rehashed; otherwise, `false`.
228230
@inlinable
229231
@inline(__always)
230232
internal mutating func ensureUnique(isUnique: Bool, capacity: Int) -> Bool {

stdlib/public/core/SliceBuffer.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ internal struct _SliceBuffer<Element>
302302
return count
303303
}
304304

305-
/// Returns `true` iff this buffer's storage is uniquely-referenced.
305+
/// Returns `true` if this buffer's storage is uniquely-referenced;
306+
/// otherwise, returns `false`.
306307
///
307308
/// This function should only be used for internal sanity checks and for
308309
/// backward compatibility.
@@ -312,8 +313,9 @@ internal struct _SliceBuffer<Element>
312313
return isKnownUniquelyReferenced(&owner)
313314
}
314315

315-
/// Returns `true` and puts the buffer in a mutable state iff the buffer's
316-
/// storage is uniquely-referenced.
316+
/// Returns `true` and puts the buffer in a mutable state if the buffer's
317+
/// storage is uniquely-referenced; otherwise, performs no action and returns
318+
/// `false`.
317319
///
318320
/// - Precondition: The buffer must be immutable.
319321
///

stdlib/public/core/String.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@ extension String {
780780
internal func _uppercaseASCII(_ x: UInt8) -> UInt8 {
781781
/// A "table" for which ASCII characters need to be upper cased.
782782
/// To determine which bit corresponds to which ASCII character, subtract 1
783-
/// from the ASCII value of that character and divide by 2. The bit is set iff
784-
/// that character is a lower case character.
783+
/// from the ASCII value of that character and divide by 2. The bit is set if
784+
/// that character is a lower case character; otherwise, it's not set.
785785
let _lowercaseTable: UInt64 =
786786
0b0001_1111_1111_1111_0000_0000_0000_0000 &<< 32
787787

@@ -804,8 +804,8 @@ extension String {
804804
internal func _lowercaseASCII(_ x: UInt8) -> UInt8 {
805805
/// A "table" for which ASCII characters need to be lower cased.
806806
/// To determine which bit corresponds to which ASCII character, subtract 1
807-
/// from the ASCII value of that character and divide by 2. The bit is set iff
808-
/// that character is a upper case character.
807+
/// from the ASCII value of that character and divide by 2. The bit is set if
808+
/// that character is a upper case character; otherwise, it's not set.
809809
let _uppercaseTable: UInt64 =
810810
0b0000_0000_0000_0000_0001_1111_1111_1111 &<< 32
811811

stdlib/public/core/SwiftNativeNSArray.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
#if _runtime(_ObjC)
2222
import SwiftShims
2323

24-
/// Returns `true` iff the given `index` is valid as a position, i.e. `0
25-
/// ≤ index ≤ count`.
24+
/// Returns `true` if the given `index` is valid as a position (`0
25+
/// ≤ index ≤ count`); otherwise, returns `false`.
2626
@usableFromInline @_transparent
2727
internal func _isValidArrayIndex(_ index: Int, count: Int) -> Bool {
2828
return (index >= 0) && (index <= count)
2929
}
3030

31-
/// Returns `true` iff the given `index` is valid for subscripting, i.e.
32-
/// `0 ≤ index < count`.
31+
/// Returns `true` if the given `index` is valid for subscripting
32+
/// (`0 ≤ index < count`); otherwise, returns `false`.
3333
@usableFromInline @_transparent
3434
internal func _isValidArraySubscript(_ index: Int, count: Int) -> Bool {
3535
return (index >= 0) && (index < count)

0 commit comments

Comments
 (0)