Skip to content

Commit 174d475

Browse files
committed
stdlib: Remove unavavailable APIs that were left as migration aids
These APIs are from the Swift 1.2 => Swift 2.0 transition, and are not relevant anymore. Removing them reduces the surface area of the library that needs to be reviewed.
1 parent 047e400 commit 174d475

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+16
-1195
lines changed

stdlib/public/SDK/CoreGraphics/CoreGraphics.swift

-96
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ public extension CGPoint {
3232
init(x: Double, y: Double) {
3333
self.init(x: CGFloat(x), y: CGFloat(y))
3434
}
35-
36-
@available(*, unavailable, renamed="zero")
37-
static var zeroPoint: CGPoint {
38-
fatalError("can't retrieve unavailable property")
39-
}
4035
}
4136

4237
extension CGPoint : Equatable {}
@@ -61,11 +56,6 @@ public extension CGSize {
6156
init(width: Double, height: Double) {
6257
self.init(width: CGFloat(width), height: CGFloat(height))
6358
}
64-
65-
@available(*, unavailable, renamed="zero")
66-
static var zeroSize: CGSize {
67-
fatalError("can't retrieve unavailable property")
68-
}
6959
}
7060

7161
extension CGSize : Equatable {}
@@ -90,11 +80,6 @@ public extension CGVector {
9080
init(dx: Double, dy: Double) {
9181
self.init(dx: CGFloat(dx), dy: CGFloat(dy))
9282
}
93-
94-
@available(*, unavailable, renamed="zero")
95-
static var zeroVector: CGVector {
96-
fatalError("can't retrieve unavailable property")
97-
}
9883
}
9984

10085
extension CGVector : Equatable {}
@@ -274,87 +259,6 @@ public extension CGRect {
274259
func intersects(rect: CGRect) -> Bool {
275260
return CGRectIntersectsRect(self, rect)
276261
}
277-
278-
@available(*, unavailable, renamed="zero")
279-
static var zeroRect: CGRect {
280-
fatalError("can't retrieve unavailable property")
281-
}
282-
283-
@available(*, unavailable, renamed="infinite")
284-
static var infiniteRect: CGRect {
285-
fatalError("can't retrieve unavailable property")
286-
}
287-
288-
@available(*, unavailable, renamed="null")
289-
static var nullRect: CGRect {
290-
fatalError("can't retrieve unavailable property")
291-
}
292-
293-
@available(*, unavailable, renamed="standardized")
294-
var standardizedRect: CGRect {
295-
fatalError("can't retrieve unavailable property")
296-
}
297-
298-
@available(*, unavailable, renamed="integral")
299-
var integerRect: CGRect {
300-
fatalError("can't retrieve unavailable property")
301-
}
302-
303-
@available(*, unavailable, renamed="standardizeInPlace")
304-
mutating func standardize() -> CGRect {
305-
fatalError("can't call unavailable function")
306-
}
307-
308-
@available(*, unavailable, renamed="makeIntegralInPlace")
309-
mutating func integerize() {
310-
fatalError("can't call unavailable function")
311-
}
312-
313-
@available(*, unavailable, renamed="insetBy")
314-
func rectByInsetting(dx dx: CGFloat, dy: CGFloat) -> CGRect {
315-
fatalError("can't call unavailable function")
316-
}
317-
318-
@available(*, unavailable, renamed="insetInPlace")
319-
func inset(dx dx: CGFloat, dy: CGFloat) {
320-
fatalError("can't call unavailable function")
321-
}
322-
323-
@available(*, unavailable, renamed="offsetBy")
324-
func rectByOffsetting(dx dx: CGFloat, dy: CGFloat) -> CGRect {
325-
fatalError("can't call unavailable function")
326-
}
327-
328-
@available(*, unavailable, renamed="offsetInPlace")
329-
func offset(dx dx: CGFloat, dy: CGFloat) {
330-
fatalError("can't call unavailable function")
331-
}
332-
333-
@available(*, unavailable, renamed="unionInPlace")
334-
mutating func union(withRect: CGRect) {
335-
fatalError("can't call unavailable function")
336-
}
337-
338-
@available(*, unavailable, renamed="union")
339-
func rectByUnion(withRect: CGRect) -> CGRect {
340-
fatalError("can't call unavailable function")
341-
}
342-
343-
@available(*, unavailable, renamed="intersectInPlace")
344-
mutating func intersect(withRect: CGRect) {
345-
fatalError("can't call unavailable function")
346-
}
347-
348-
@available(*, unavailable, renamed="intersect")
349-
func rectByIntersecting(withRect: CGRect) -> CGRect {
350-
fatalError("can't call unavailable function")
351-
}
352-
353-
@available(*, unavailable, renamed="divide")
354-
func rectsByDividing(atDistance: CGFloat, fromEdge: CGRectEdge)
355-
-> (slice: CGRect, remainder: CGRect) {
356-
fatalError("can't call unavailable function")
357-
}
358262
}
359263

360264
extension CGRect : Equatable {}

stdlib/public/core/Algorithm.swift

-182
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
/// Returns the minimum element in `elements`.
14-
///
15-
/// - Requires: `elements` is non-empty. O(`elements.count`).
16-
@available(*, unavailable, message="call the 'minElement()' method on the sequence")
17-
public func minElement<
18-
R : SequenceType
19-
where R.Generator.Element : Comparable>(elements: R)
20-
-> R.Generator.Element {
21-
fatalError("unavailable function can't be called")
22-
}
23-
24-
/// Returns the maximum element in `elements`.
25-
///
26-
/// - Requires: `elements` is non-empty. O(`elements.count`).
27-
@available(*, unavailable, message="call the 'maxElement()' method on the sequence")
28-
public func maxElement<
29-
R : SequenceType
30-
where R.Generator.Element : Comparable>(elements: R)
31-
-> R.Generator.Element {
32-
fatalError("unavailable function can't be called")
33-
}
34-
35-
/// Returns the first index where `value` appears in `domain` or `nil` if
36-
/// `value` is not found.
37-
///
38-
/// - Complexity: O(`domain.count`).
39-
@available(*, unavailable, message="call the 'indexOf()' method on the collection")
40-
public func find<
41-
C: CollectionType where C.Generator.Element : Equatable
42-
>(domain: C, _ value: C.Generator.Element) -> C.Index? {
43-
fatalError("unavailable function can't be called")
44-
}
45-
4613
/// Returns the lesser of `x` and `y`.
4714
@warn_unused_result
4815
public func min<T : Comparable>(x: T, _ y: T) -> T {
@@ -99,53 +66,6 @@ public func max<T : Comparable>(x: T, _ y: T, _ z: T, _ rest: T...) -> T {
9966
return r
10067
}
10168

102-
/// Returns the result of slicing `elements` into sub-sequences that
103-
/// don't contain elements satisfying the predicate `isSeparator`.
104-
///
105-
/// - parameter maxSplit: The maximum number of slices to return, minus 1.
106-
/// If `maxSplit + 1` slices would otherwise be returned, the
107-
/// algorithm stops splitting and returns a suffix of `elements`.
108-
///
109-
/// - parameter allowEmptySlices: If `true`, an empty slice is produced in
110-
/// the result for each pair of consecutive.
111-
@available(*, unavailable, message="Use the split() method instead.")
112-
public func split<S : CollectionType, R : BooleanType>(
113-
elements: S,
114-
maxSplit: Int = Int.max,
115-
allowEmptySlices: Bool = false,
116-
@noescape isSeparator: (S.Generator.Element) -> R
117-
) -> [S.SubSequence] {
118-
fatalError("unavailable function can't be called")
119-
}
120-
121-
/// Returns `true` iff the the initial elements of `s` are equal to `prefix`.
122-
@available(*, unavailable, message="call the 'startsWith()' method on the sequence")
123-
public func startsWith<
124-
S0 : SequenceType, S1 : SequenceType
125-
where
126-
S0.Generator.Element == S1.Generator.Element,
127-
S0.Generator.Element : Equatable
128-
>(s: S0, _ prefix: S1) -> Bool
129-
{
130-
fatalError("unavailable function can't be called")
131-
}
132-
133-
/// Returns `true` iff `s` begins with elements equivalent to those of
134-
/// `prefix`, using `isEquivalent` as the equivalence test.
135-
///
136-
/// - Requires: `isEquivalent` is an [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation).
137-
@available(*, unavailable, message="call the 'startsWith()' method on the sequence")
138-
public func startsWith<
139-
S0 : SequenceType, S1 : SequenceType
140-
where
141-
S0.Generator.Element == S1.Generator.Element
142-
>(s: S0, _ prefix: S1,
143-
@noescape _ isEquivalent: (S1.Generator.Element, S1.Generator.Element) -> Bool)
144-
-> Bool
145-
{
146-
fatalError("unavailable function can't be called")
147-
}
148-
14969
/// The `GeneratorType` for `EnumerateSequence`. `EnumerateGenerator`
15070
/// wraps a `Base` `GeneratorType` and yields successive `Int` values,
15171
/// starting at zero, along with the elements of the underlying
@@ -209,105 +129,3 @@ public struct EnumerateSequence<Base : SequenceType> : SequenceType {
209129
}
210130
}
211131

212-
/// Returns a lazy `SequenceType` containing pairs (*n*, *x*), where
213-
/// *n*s are consecutive `Int`s starting at zero, and *x*s are
214-
/// the elements of `base`:
215-
///
216-
/// > for (n, c) in enumerate("Swift".characters) {
217-
/// print("\(n): '\(c)'" )
218-
/// }
219-
/// 0: 'S'
220-
/// 1: 'w'
221-
/// 2: 'i'
222-
/// 3: 'f'
223-
/// 4: 't'
224-
@available(*, unavailable, message="call the 'enumerate()' method on the sequence")
225-
public func enumerate<Seq : SequenceType>(
226-
base: Seq
227-
) -> EnumerateSequence<Seq> {
228-
fatalError("unavailable function can't be called")
229-
}
230-
231-
/// Returns `true` iff `a1` and `a2` contain the same elements in the
232-
/// same order.
233-
@available(*, unavailable, message="call the 'equalElements()' method on the sequence")
234-
public func equal<
235-
S1 : SequenceType, S2 : SequenceType
236-
where
237-
S1.Generator.Element == S2.Generator.Element,
238-
S1.Generator.Element : Equatable
239-
>(a1: S1, _ a2: S2) -> Bool {
240-
fatalError("unavailable function can't be called")
241-
}
242-
243-
/// Returns `true` iff `a1` and `a2` contain equivalent elements, using
244-
/// `isEquivalent` as the equivalence test.
245-
///
246-
/// - Requires: `isEquivalent` is an [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation).
247-
@available(*, unavailable, message="call the 'equalElements()' method on the sequence")
248-
public func equal<
249-
S1 : SequenceType, S2 : SequenceType
250-
where
251-
S1.Generator.Element == S2.Generator.Element
252-
>(a1: S1, _ a2: S2,
253-
@noescape _ isEquivalent: (S1.Generator.Element, S1.Generator.Element) -> Bool)
254-
-> Bool {
255-
fatalError("unavailable function can't be called")
256-
}
257-
258-
/// Returns `true` iff `a1` precedes `a2` in a lexicographical ("dictionary")
259-
/// ordering, using "<" as the comparison between elements.
260-
@available(*, unavailable, message="call the 'lexicographicalCompare()' method on the sequence")
261-
public func lexicographicalCompare<
262-
S1 : SequenceType, S2 : SequenceType
263-
where
264-
S1.Generator.Element == S2.Generator.Element,
265-
S1.Generator.Element : Comparable>(
266-
a1: S1, _ a2: S2) -> Bool {
267-
fatalError("unavailable function can't be called")
268-
}
269-
270-
/// Returns `true` iff `a1` precedes `a2` in a lexicographical ("dictionary")
271-
/// ordering, using `isOrderedBefore` as the comparison between elements.
272-
///
273-
/// - Requires: `isOrderedBefore` is a
274-
/// [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
275-
/// over the elements of `a1` and `a2`.
276-
@available(*, unavailable, message="call the 'lexicographicalCompare()' method on the sequence")
277-
public func lexicographicalCompare<
278-
S1 : SequenceType, S2 : SequenceType
279-
where
280-
S1.Generator.Element == S2.Generator.Element
281-
>(
282-
a1: S1, _ a2: S2,
283-
@noescape isOrderedBefore less: (S1.Generator.Element, S1.Generator.Element)
284-
-> Bool
285-
) -> Bool {
286-
fatalError("unavailable function can't be called")
287-
}
288-
289-
/// Returns `true` iff an element in `seq` satisfies `predicate`.
290-
@available(*, unavailable, message="call the 'contains()' method on the sequence")
291-
public func contains<
292-
S : SequenceType, L : BooleanType
293-
>(seq: S, @noescape _ predicate: (S.Generator.Element) -> L) -> Bool {
294-
fatalError("unavailable function can't be called")
295-
}
296-
297-
/// Returns `true` iff `x` is in `seq`.
298-
@available(*, unavailable, message="call the 'contains()' method on the sequence")
299-
public func contains<
300-
S : SequenceType where S.Generator.Element : Equatable
301-
>(seq: S, _ x: S.Generator.Element) -> Bool {
302-
fatalError("unavailable function can't be called")
303-
}
304-
305-
/// Returns the result of repeatedly calling `combine` with an
306-
/// accumulated value initialized to `initial` and each element of
307-
/// `sequence`, in turn.
308-
@available(*, unavailable, message="call the 'reduce()' method on the sequence")
309-
public func reduce<S : SequenceType, U>(
310-
sequence: S, _ initial: U, @noescape _ combine: (U, S.Generator.Element) -> U
311-
) -> U {
312-
fatalError("unavailable function can't be called")
313-
}

stdlib/public/core/Arrays.swift.gyb

-14
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ ${SelfDocComment}
169169
public struct ${Self}<Element>
170170
: CollectionType, MutableCollectionType, _DestructorSafeContainer {
171171

172-
@available(*, unavailable, renamed="Element")
173-
public typealias T = Element
174-
175172
%if Self == 'ArraySlice':
176173
/// The position of the first element in a non-empty collection.
177174
///
@@ -765,17 +762,6 @@ extension ${Self} : _ArrayType {
765762
}
766763
}
767764

768-
/// Returns a copy of `self` that has been sorted according to
769-
/// `isOrderedBefore`.
770-
///
771-
/// - Requires: `isOrderedBefore` induces a
772-
/// [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
773-
/// over the elements.
774-
@available(*, unavailable, message="call the 'sort()' method on the array")
775-
public func sorted(isOrderedBefore: (Element, Element) -> Bool) -> ${Self} {
776-
fatalError("unavailable function can't be called")
777-
}
778-
779765
@warn_unused_result
780766
public func _copyToNativeArrayBuffer() -> _ContiguousArrayBuffer<Element> {
781767
return _extractOrCopyToNativeArrayBuffer(self._buffer)

stdlib/public/core/BridgeObjectiveC.swift

-3
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ internal var _nilNativeObject: AnyObject? {
341341
public struct AutoreleasingUnsafeMutablePointer<Memory /* TODO : class */>
342342
: Equatable, NilLiteralConvertible, _PointerType {
343343

344-
@available(*, unavailable, renamed="Memory")
345-
public typealias T = Memory
346-
347344
public let _rawValue: Builtin.RawPointer
348345

349346
@_transparent

stdlib/public/core/CTypes.swift

-7
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ public func ==(lhs: COpaquePointer, rhs: COpaquePointer) -> Bool {
154154
return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
155155
}
156156

157-
/// The family of C function pointer types.
158-
///
159-
/// This type has been removed. Instead of `CFunctionType<(T) -> U>`, a native
160-
/// function type with the C convention can be used, `@convention(c) (T) -> U`.
161-
@available(*, unavailable, message="use a function type '@convention(c) (T) -> U'")
162-
public struct CFunctionPointer<T> {}
163-
164157
/// The corresponding Swift type to `va_list` in imported C APIs.
165158
public struct CVaListPointer {
166159
var value: UnsafeMutablePointer<Void>

0 commit comments

Comments
 (0)