Skip to content

Commit c6b41a5

Browse files
committed
Inlineable: protocol interface only
1 parent f1cba89 commit c6b41a5

14 files changed

+50
-50
lines changed

stdlib/public/core/Algorithm.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// - x: A value to compare.
1717
/// - y: Another value to compare.
1818
/// - Returns: The lesser of `x` and `y`. If `x` is equal to `y`, returns `x`.
19-
@inlinable
19+
@inlinable // protocol-only
2020
public func min<T : Comparable>(_ x: T, _ y: T) -> T {
2121
// In case `x == y` we pick `x`.
2222
// This preserves any pre-existing order in case `T` has identity,
@@ -34,7 +34,7 @@ public func min<T : Comparable>(_ x: T, _ y: T) -> T {
3434
/// - rest: Zero or more additional values.
3535
/// - Returns: The least of all the arguments. If there are multiple equal
3636
/// least arguments, the result is the first one.
37-
@inlinable
37+
@inlinable // protocol-only
3838
public func min<T : Comparable>(_ x: T, _ y: T, _ z: T, _ rest: T...) -> T {
3939
var minValue = min(min(x, y), z)
4040
// In case `value == minValue`, we pick `minValue`. See min(_:_:).
@@ -50,7 +50,7 @@ public func min<T : Comparable>(_ x: T, _ y: T, _ z: T, _ rest: T...) -> T {
5050
/// - x: A value to compare.
5151
/// - y: Another value to compare.
5252
/// - Returns: The greater of `x` and `y`. If `x` is equal to `y`, returns `y`.
53-
@inlinable
53+
@inlinable // protocol-only
5454
public func max<T : Comparable>(_ x: T, _ y: T) -> T {
5555
// In case `x == y`, we pick `y`. See min(_:_:).
5656
return y >= x ? y : x
@@ -65,7 +65,7 @@ public func max<T : Comparable>(_ x: T, _ y: T) -> T {
6565
/// - rest: Zero or more additional values.
6666
/// - Returns: The greatest of all the arguments. If there are multiple equal
6767
/// greatest arguments, the result is the last one.
68-
@inlinable
68+
@inlinable // protocol-only
6969
public func max<T : Comparable>(_ x: T, _ y: T, _ z: T, _ rest: T...) -> T {
7070
var maxValue = max(max(x, y), z)
7171
// In case `value == maxValue`, we pick `value`. See min(_:_:).

stdlib/public/core/Assert.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public func _debugPrecondition(
267267
file: StaticString = #file, line: UInt = #line
268268
) {
269269
// Only check in debug mode.
270-
if _isDebugAssertConfiguration() {
270+
if _slowPath(_isDebugAssertConfiguration()) {
271271
if !_branchHint(condition(), expected: true) {
272272
_fatalErrorMessage("Fatal error", message, file: file, line: line,
273273
flags: _fatalErrorFlags())
@@ -281,7 +281,7 @@ public func _debugPreconditionFailure(
281281
_ message: StaticString = StaticString(),
282282
file: StaticString = #file, line: UInt = #line
283283
) -> Never {
284-
if _isDebugAssertConfiguration() {
284+
if _slowPath(_isDebugAssertConfiguration()) {
285285
_precondition(false, message, file: file, line: line)
286286
}
287287
_conditionallyUnreachable()

stdlib/public/core/BidirectionalCollection.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection {
131131
/// Default implementation for bidirectional collections.
132132
extension BidirectionalCollection {
133133

134-
@inlinable // FIXME(sil-serialize-all)
134+
@inlinable // protocol-only
135135
@inline(__always)
136136
public func formIndex(before i: inout Index) {
137137
i = index(before: i)
138138
}
139139

140-
@inlinable // FIXME(sil-serialize-all)
140+
@inlinable // protocol-only
141141
public func index(_ i: Index, offsetBy n: Int) -> Index {
142142
if n >= 0 {
143143
return _advanceForward(i, by: n)
@@ -149,7 +149,7 @@ extension BidirectionalCollection {
149149
return i
150150
}
151151

152-
@inlinable // FIXME(sil-serialize-all)
152+
@inlinable // protocol-only
153153
public func index(
154154
_ i: Index, offsetBy n: Int, limitedBy limit: Index
155155
) -> Index? {
@@ -166,7 +166,7 @@ extension BidirectionalCollection {
166166
return i
167167
}
168168

169-
@inlinable // FIXME(sil-serialize-all)
169+
@inlinable // protocol-only
170170
public func distance(from start: Index, to end: Index) -> Int {
171171
var start = start
172172
var count = 0
@@ -199,7 +199,7 @@ extension BidirectionalCollection where SubSequence == Self {
199199
/// or more elements; otherwise, `nil`.
200200
///
201201
/// - Complexity: O(1).
202-
@inlinable // FIXME(sil-serialize-all)
202+
@inlinable // protocol-only
203203
public mutating func popLast() -> Element? {
204204
guard !isEmpty else { return nil }
205205
let element = last!
@@ -215,7 +215,7 @@ extension BidirectionalCollection where SubSequence == Self {
215215
/// - Returns: The last element of the collection.
216216
///
217217
/// - Complexity: O(1)
218-
@inlinable // FIXME(sil-serialize-all)
218+
@inlinable // protocol-only
219219
@discardableResult
220220
public mutating func removeLast() -> Element {
221221
let element = last!
@@ -232,7 +232,7 @@ extension BidirectionalCollection where SubSequence == Self {
232232
/// - Complexity: O(1) if the collection conforms to
233233
/// `RandomAccessCollection`; otherwise, O(*n*), where *n* is the length
234234
/// of the collection.
235-
@inlinable // FIXME(sil-serialize-all)
235+
@inlinable // protocol-only
236236
public mutating func removeLast(_ n: Int) {
237237
if n == 0 { return }
238238
_precondition(n >= 0, "Number of elements to remove should be non-negative")
@@ -260,7 +260,7 @@ extension BidirectionalCollection {
260260
/// - Returns: A subsequence that leaves off `n` elements from the end.
261261
///
262262
/// - Complexity: O(*n*), where *n* is the number of elements to drop.
263-
@inlinable // FIXME(sil-serialize-all)
263+
@inlinable // protocol-only
264264
public func dropLast(_ n: Int) -> SubSequence {
265265
_precondition(
266266
n >= 0, "Can't drop a negative number of elements from a collection")
@@ -289,7 +289,7 @@ extension BidirectionalCollection {
289289
/// most `maxLength` elements.
290290
///
291291
/// - Complexity: O(*n*), where *n* is equal to `maxLength`.
292-
@inlinable // FIXME(sil-serialize-all)
292+
@inlinable // protocol-only
293293
public func suffix(_ maxLength: Int) -> SubSequence {
294294
_precondition(
295295
maxLength >= 0,

stdlib/public/core/Collection.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ extension Collection {
804804
///
805805
/// - Parameter i: A valid index of the collection. `i` must be less than
806806
/// `endIndex`.
807-
@inlinable // FIXME(sil-serialize-all)
807+
@inlinable // protocol-only
808808
@inline(__always)
809809
public func formIndex(after i: inout Index) {
810810
i = index(after: i)

stdlib/public/core/Equatable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extension Equatable {
188188
/// - Parameters:
189189
/// - lhs: A value to compare.
190190
/// - rhs: Another value to compare.
191-
@inlinable // FIXME(sil-serialize-all)
191+
@inlinable // protocol-only
192192
@_transparent
193193
public static func != (lhs: Self, rhs: Self) -> Bool {
194194
return !(lhs == rhs)

stdlib/public/core/LazyCollection.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public protocol LazyCollectionProtocol: Collection, LazySequenceProtocol {
2929

3030
extension LazyCollectionProtocol {
3131
// Lazy things are already lazy
32-
@inlinable // FIXME(sil-serialize-all)
32+
@inlinable // protocol-only
3333
public var lazy: LazyCollection<Elements> {
3434
return elements.lazy
3535
}
3636
}
3737

3838
extension LazyCollectionProtocol where Elements: LazyCollectionProtocol {
3939
// Lazy things are already lazy
40-
@inlinable // FIXME(sil-serialize-all)
40+
@inlinable // protocol-only
4141
public var lazy: Elements {
4242
return elements
4343
}

stdlib/public/core/LazySequence.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ public protocol LazySequenceProtocol : Sequence {
154154
/// property is provided.
155155
extension LazySequenceProtocol where Elements == Self {
156156
/// Identical to `self`.
157-
@inlinable // FIXME(sil-serialize-all)
157+
@inlinable // protocol-only
158158
public var elements: Self { return self }
159159
}
160160

161161
extension LazySequenceProtocol {
162-
@inlinable // FIXME(sil-serialize-all)
162+
@inlinable // protocol-only
163163
public var lazy: LazySequence<Elements> {
164164
return elements.lazy
165165
}
166166
}
167167

168168
extension LazySequenceProtocol where Elements: LazySequenceProtocol {
169-
@inlinable // FIXME(sil-serialize-all)
169+
@inlinable // protocol-only
170170
public var lazy: Elements {
171171
return elements
172172
}
@@ -202,7 +202,7 @@ extension Sequence {
202202
/// A sequence containing the same elements as this sequence,
203203
/// but on which some operations, such as `map` and `filter`, are
204204
/// implemented lazily.
205-
@inlinable // FIXME(sil-serialize-all)
205+
@inlinable // protocol-only
206206
public var lazy: LazySequence<Self> {
207207
return LazySequence(_base: self)
208208
}

stdlib/public/core/RandomAccessCollection.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ where Index : Strideable,
195195
/// - Parameter i: A valid index of the collection. `i` must be greater than
196196
/// `startIndex`.
197197
/// - Returns: The index value immediately before `i`.
198-
@inlinable // FIXME(sil-serialize-all)
198+
@inlinable // protocol-only
199199
public func index(before i: Index) -> Index {
200200
let result = i.advanced(by: -1)
201201
// FIXME: swift-3-indexing-model: tests for the trap.

stdlib/public/core/Range.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ extension Comparable {
644644
/// - Parameters:
645645
/// - minimum: The lower bound for the range.
646646
/// - maximum: The upper bound for the range.
647-
@inlinable // FIXME(sil-serialize-all)
647+
@inlinable // protocol-only
648648
@_transparent
649649
public static func ..< (minimum: Self, maximum: Self) -> Range<Self> {
650650
_precondition(minimum <= maximum,
@@ -674,7 +674,7 @@ extension Comparable {
674674
/// // Prints "[10, 20, 30]"
675675
///
676676
/// - Parameter maximum: The upper bound for the range.
677-
@inlinable // FIXME(sil-serialize-all)
677+
@inlinable // protocol-only
678678
@_transparent
679679
public static prefix func ..< (maximum: Self) -> PartialRangeUpTo<Self> {
680680
return PartialRangeUpTo(maximum)
@@ -702,7 +702,7 @@ extension Comparable {
702702
/// // Prints "[10, 20, 30, 40]"
703703
///
704704
/// - Parameter maximum: The upper bound for the range.
705-
@inlinable // FIXME(sil-serialize-all)
705+
@inlinable // protocol-only
706706
@_transparent
707707
public static prefix func ... (maximum: Self) -> PartialRangeThrough<Self> {
708708
return PartialRangeThrough(maximum)
@@ -730,7 +730,7 @@ extension Comparable {
730730
/// // Prints "[40, 50, 60, 70]"
731731
///
732732
/// - Parameter minimum: The lower bound for the range.
733-
@inlinable // FIXME(sil-serialize-all)
733+
@inlinable // protocol-only
734734
@_transparent
735735
public static postfix func ... (minimum: Self) -> PartialRangeFrom<Self> {
736736
return PartialRangeFrom(minimum)

stdlib/public/core/Reverse.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension MutableCollection where Self: BidirectionalCollection {
2222
///
2323
/// - Complexity: O(*n*), where *n* is the number of elements in the
2424
/// collection.
25-
@inlinable // FIXME(sil-serialize-all)
25+
@inlinable // protocol-only
2626
public mutating func reverse() {
2727
if isEmpty { return }
2828
var f = startIndex

stdlib/public/core/SequenceAlgorithms.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension Sequence {
6161
/// // Prints "Mateo"
6262
///
6363
/// - Returns: A sequence of pairs enumerating the sequence.
64-
@inlinable
64+
@inlinable // protocol-only
6565
public func enumerated() -> EnumeratedSequence<Self> {
6666
return EnumeratedSequence(_base: self)
6767
}
@@ -102,7 +102,7 @@ extension Sequence {
102102
/// - Returns: The sequence's minimum element, according to
103103
/// `areInIncreasingOrder`. If the sequence has no elements, returns
104104
/// `nil`.
105-
@inlinable
105+
@inlinable // protocol-only
106106
@warn_unqualified_access
107107
public func min(
108108
by areInIncreasingOrder: (Element, Element) throws -> Bool
@@ -144,7 +144,7 @@ extension Sequence {
144144
/// otherwise, `false`.
145145
/// - Returns: The sequence's maximum element if the sequence is not empty;
146146
/// otherwise, `nil`.
147-
@inlinable
147+
@inlinable // protocol-only
148148
@warn_unqualified_access
149149
public func max(
150150
by areInIncreasingOrder: (Element, Element) throws -> Bool
@@ -742,7 +742,7 @@ extension Sequence {
742742
///
743743
/// - Complexity: O(*m* + *n*), where *m* is the length of this sequence
744744
/// and *n* is the length of the result.
745-
@inlinable
745+
@inlinable // protocol-only
746746
public func compactMap<ElementOfResult>(
747747
_ transform: (Element) throws -> ElementOfResult?
748748
) rethrows -> [ElementOfResult] {
@@ -752,7 +752,7 @@ extension Sequence {
752752
// The implementation of flatMap accepting a closure with an optional result.
753753
// Factored out into a separate functions in order to be used in multiple
754754
// overloads.
755-
@inlinable // FIXME(sil-serialize-all)
755+
@inlinable // protocol-only
756756
@inline(__always)
757757
public func _compactMap<ElementOfResult>(
758758
_ transform: (Element) throws -> ElementOfResult?

stdlib/public/core/SetAlgebra.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ extension SetAlgebra {
405405
/// // Prints "[6, 0, 1, 3]"
406406
///
407407
/// - Parameter sequence: The elements to use as members of the new set.
408-
@inlinable // FIXME(sil-serialize-all)
408+
@inlinable // protocol-only
409409
public init<S : Sequence>(_ sequence: S)
410410
where S.Element == Element {
411411
self.init()
@@ -425,7 +425,7 @@ extension SetAlgebra {
425425
/// // Prints "["Diana", "Chris", "Alicia"]"
426426
///
427427
/// - Parameter other: A set of the same type as the current set.
428-
@inlinable // FIXME(sil-serialize-all)
428+
@inlinable // protocol-only
429429
public mutating func subtract(_ other: Self) {
430430
self.formIntersection(self.symmetricDifference(other))
431431
}
@@ -443,7 +443,7 @@ extension SetAlgebra {
443443
///
444444
/// - Parameter other: A set of the same type as the current set.
445445
/// - Returns: `true` if the set is a subset of `other`; otherwise, `false`.
446-
@inlinable // FIXME(sil-serialize-all)
446+
@inlinable // protocol-only
447447
public func isSubset(of other: Self) -> Bool {
448448
return self.intersection(other) == self
449449
}
@@ -462,7 +462,7 @@ extension SetAlgebra {
462462
/// - Parameter other: A set of the same type as the current set.
463463
/// - Returns: `true` if the set is a superset of `other`; otherwise,
464464
/// `false`.
465-
@inlinable // FIXME(sil-serialize-all)
465+
@inlinable // protocol-only
466466
public func isSuperset(of other: Self) -> Bool {
467467
return other.isSubset(of: self)
468468
}
@@ -481,7 +481,7 @@ extension SetAlgebra {
481481
/// - Parameter other: A set of the same type as the current set.
482482
/// - Returns: `true` if the set has no elements in common with `other`;
483483
/// otherwise, `false`.
484-
@inlinable // FIXME(sil-serialize-all)
484+
@inlinable // protocol-only
485485
public func isDisjoint(with other: Self) -> Bool {
486486
return self.intersection(other).isEmpty
487487
}
@@ -500,13 +500,13 @@ extension SetAlgebra {
500500
///
501501
/// - Parameter other: A set of the same type as the current set.
502502
/// - Returns: A new set.
503-
@inlinable // FIXME(sil-serialize-all)
503+
@inlinable // protocol-only
504504
public func subtracting(_ other: Self) -> Self {
505505
return self.intersection(self.symmetricDifference(other))
506506
}
507507

508508
/// A Boolean value that indicates whether the set has no elements.
509-
@inlinable // FIXME(sil-serialize-all)
509+
@inlinable // protocol-only
510510
public var isEmpty: Bool {
511511
return self == Self()
512512
}
@@ -530,7 +530,7 @@ extension SetAlgebra {
530530
/// - Parameter other: A set of the same type as the current set.
531531
/// - Returns: `true` if the set is a strict superset of `other`; otherwise,
532532
/// `false`.
533-
@inlinable // FIXME(sil-serialize-all)
533+
@inlinable // protocol-only
534534
public func isStrictSuperset(of other: Self) -> Bool {
535535
return self.isSuperset(of: other) && self != other
536536
}
@@ -554,7 +554,7 @@ extension SetAlgebra {
554554
/// - Parameter other: A set of the same type as the current set.
555555
/// - Returns: `true` if the set is a strict subset of `other`; otherwise,
556556
/// `false`.
557-
@inlinable // FIXME(sil-serialize-all)
557+
@inlinable // protocol-only
558558
public func isStrictSubset(of other: Self) -> Bool {
559559
return other.isStrictSuperset(of: self)
560560
}
@@ -579,7 +579,7 @@ extension SetAlgebra where Element == ArrayLiteralElement {
579579
/// // Prints "Whatever it is, it's bound to be delicious!"
580580
///
581581
/// - Parameter arrayLiteral: A list of elements of the new set.
582-
@inlinable // FIXME(sil-serialize-all)
582+
@inlinable // protocol-only
583583
public init(arrayLiteral: Element...) {
584584
self.init(arrayLiteral)
585585
}

0 commit comments

Comments
 (0)