Skip to content

Commit d8d7edf

Browse files
[stdlib][NFC] Warning cleanup (swiftlang#14727)
* Remove Countable use from _ArrayBufferProtocol * Mark _SwiftNativeNSArrayWithContiguousStorage's init @nonobjc * Give {Closed}Range a _customIndexOfEquatableElement, supressing warning for _customContainsEquatableElement near-miss * Eliminate CharacterView.init warning, since it's hard to supress and these things warn constantly.
1 parent 4d9e1b0 commit d8d7edf

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

stdlib/public/core/ArrayBufferProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ internal protocol _ArrayBufferProtocol
126126
var endIndex: Int { get }
127127
}
128128

129-
extension _ArrayBufferProtocol where Indices == CountableRange<Int>{
129+
extension _ArrayBufferProtocol where Indices == Range<Int>{
130130

131131
@_inlineable
132132
@_versioned
@@ -142,7 +142,7 @@ extension _ArrayBufferProtocol where Indices == CountableRange<Int>{
142142
let newBuffer = _ContiguousArrayBuffer<Element>(
143143
_uninitializedCount: buffer.count, minimumCapacity: buffer.count)
144144
buffer._copyContents(
145-
subRange: Range(buffer.indices),
145+
subRange: buffer.indices,
146146
initializing: newBuffer.firstElementAddress)
147147
self = Self( _buffer: newBuffer, shiftedToStartIndex: buffer.startIndex)
148148
}

stdlib/public/core/ClosedRange.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,13 @@ where Bound : Strideable, Bound.Stride : SignedInteger
292292

293293
@_inlineable
294294
public func _customContainsEquatableElement(_ element: Bound) -> Bool? {
295-
return element >= self.lowerBound && element <= self.upperBound
295+
return lowerBound <= element && element <= upperBound
296+
}
297+
298+
@_inlineable
299+
public func _customIndexOfEquatableElement(_ element: Bound) -> Index?? {
300+
return lowerBound <= element && element <= upperBound
301+
? .inRange(element) : nil
296302
}
297303
}
298304

stdlib/public/core/Range.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ where Bound : Strideable, Bound.Stride : SignedInteger
250250
return lowerBound <= element && element < upperBound
251251
}
252252

253+
@_inlineable
254+
public func _customIndexOfEquatableElement(_ element: Bound) -> Index?? {
255+
return lowerBound <= element && element < upperBound ? element : nil
256+
}
257+
253258
/// Accesses the element at specified position.
254259
///
255260
/// You can subscript a collection with any valid index other than the

stdlib/public/core/Substring.swift.gyb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,6 @@ extension Substring {
472472
///
473473
/// - Complexity: O(1)
474474
@_inlineable // FIXME(sil-serialize-all)
475-
% if property == 'characters':
476-
@available(swift, deprecated: 3.2, message:
477-
"Please use String or Substring directly")
478-
% end
479475
public init(_ content: ${View}) {
480476
self = content._wholeString[content.startIndex..<content.endIndex]
481477
}

stdlib/public/core/SwiftNativeNSArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal class _SwiftNativeNSArrayWithContiguousStorage
4848

4949
@_inlineable // FIXME(sil-serialize-all)
5050
@_versioned // FIXME(sil-serialize-all)
51-
internal override init() {}
51+
@nonobjc internal override init() {}
5252

5353
@_inlineable // FIXME(sil-serialize-all)
5454
@_versioned // FIXME(sil-serialize-all)

0 commit comments

Comments
 (0)