Skip to content

stdlib: Remove unavavailable APIs that were left as migration aids #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions stdlib/public/SDK/CoreGraphics/CoreGraphics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ public extension CGPoint {
init(x: Double, y: Double) {
self.init(x: CGFloat(x), y: CGFloat(y))
}

@available(*, unavailable, renamed="zero")
static var zeroPoint: CGPoint {
fatalError("can't retrieve unavailable property")
}
}

extension CGPoint : Equatable {}
Expand All @@ -61,11 +56,6 @@ public extension CGSize {
init(width: Double, height: Double) {
self.init(width: CGFloat(width), height: CGFloat(height))
}

@available(*, unavailable, renamed="zero")
static var zeroSize: CGSize {
fatalError("can't retrieve unavailable property")
}
}

extension CGSize : Equatable {}
Expand All @@ -90,11 +80,6 @@ public extension CGVector {
init(dx: Double, dy: Double) {
self.init(dx: CGFloat(dx), dy: CGFloat(dy))
}

@available(*, unavailable, renamed="zero")
static var zeroVector: CGVector {
fatalError("can't retrieve unavailable property")
}
}

extension CGVector : Equatable {}
Expand Down Expand Up @@ -274,87 +259,6 @@ public extension CGRect {
func intersects(rect: CGRect) -> Bool {
return CGRectIntersectsRect(self, rect)
}

@available(*, unavailable, renamed="zero")
static var zeroRect: CGRect {
fatalError("can't retrieve unavailable property")
}

@available(*, unavailable, renamed="infinite")
static var infiniteRect: CGRect {
fatalError("can't retrieve unavailable property")
}

@available(*, unavailable, renamed="null")
static var nullRect: CGRect {
fatalError("can't retrieve unavailable property")
}

@available(*, unavailable, renamed="standardized")
var standardizedRect: CGRect {
fatalError("can't retrieve unavailable property")
}

@available(*, unavailable, renamed="integral")
var integerRect: CGRect {
fatalError("can't retrieve unavailable property")
}

@available(*, unavailable, renamed="standardizeInPlace")
mutating func standardize() -> CGRect {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="makeIntegralInPlace")
mutating func integerize() {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="insetBy")
func rectByInsetting(dx dx: CGFloat, dy: CGFloat) -> CGRect {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="insetInPlace")
func inset(dx dx: CGFloat, dy: CGFloat) {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="offsetBy")
func rectByOffsetting(dx dx: CGFloat, dy: CGFloat) -> CGRect {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="offsetInPlace")
func offset(dx dx: CGFloat, dy: CGFloat) {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="unionInPlace")
mutating func union(withRect: CGRect) {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="union")
func rectByUnion(withRect: CGRect) -> CGRect {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="intersectInPlace")
mutating func intersect(withRect: CGRect) {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="intersect")
func rectByIntersecting(withRect: CGRect) -> CGRect {
fatalError("can't call unavailable function")
}

@available(*, unavailable, renamed="divide")
func rectsByDividing(atDistance: CGFloat, fromEdge: CGRectEdge)
-> (slice: CGRect, remainder: CGRect) {
fatalError("can't call unavailable function")
}
}

extension CGRect : Equatable {}
Expand Down
182 changes: 0 additions & 182 deletions stdlib/public/core/Algorithm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,6 @@
//
//===----------------------------------------------------------------------===//

/// Returns the minimum element in `elements`.
///
/// - Requires: `elements` is non-empty. O(`elements.count`).
@available(*, unavailable, message="call the 'minElement()' method on the sequence")
public func minElement<
R : SequenceType
where R.Generator.Element : Comparable>(elements: R)
-> R.Generator.Element {
fatalError("unavailable function can't be called")
}

/// Returns the maximum element in `elements`.
///
/// - Requires: `elements` is non-empty. O(`elements.count`).
@available(*, unavailable, message="call the 'maxElement()' method on the sequence")
public func maxElement<
R : SequenceType
where R.Generator.Element : Comparable>(elements: R)
-> R.Generator.Element {
fatalError("unavailable function can't be called")
}

/// Returns the first index where `value` appears in `domain` or `nil` if
/// `value` is not found.
///
/// - Complexity: O(`domain.count`).
@available(*, unavailable, message="call the 'indexOf()' method on the collection")
public func find<
C: CollectionType where C.Generator.Element : Equatable
>(domain: C, _ value: C.Generator.Element) -> C.Index? {
fatalError("unavailable function can't be called")
}

/// Returns the lesser of `x` and `y`.
@warn_unused_result
public func min<T : Comparable>(x: T, _ y: T) -> T {
Expand Down Expand Up @@ -99,53 +66,6 @@ public func max<T : Comparable>(x: T, _ y: T, _ z: T, _ rest: T...) -> T {
return r
}

/// Returns the result of slicing `elements` into sub-sequences that
/// don't contain elements satisfying the predicate `isSeparator`.
///
/// - parameter maxSplit: The maximum number of slices to return, minus 1.
/// If `maxSplit + 1` slices would otherwise be returned, the
/// algorithm stops splitting and returns a suffix of `elements`.
///
/// - parameter allowEmptySlices: If `true`, an empty slice is produced in
/// the result for each pair of consecutive.
@available(*, unavailable, message="Use the split() method instead.")
public func split<S : CollectionType, R : BooleanType>(
elements: S,
maxSplit: Int = Int.max,
allowEmptySlices: Bool = false,
@noescape isSeparator: (S.Generator.Element) -> R
) -> [S.SubSequence] {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff the the initial elements of `s` are equal to `prefix`.
@available(*, unavailable, message="call the 'startsWith()' method on the sequence")
public func startsWith<
S0 : SequenceType, S1 : SequenceType
where
S0.Generator.Element == S1.Generator.Element,
S0.Generator.Element : Equatable
>(s: S0, _ prefix: S1) -> Bool
{
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `s` begins with elements equivalent to those of
/// `prefix`, using `isEquivalent` as the equivalence test.
///
/// - Requires: `isEquivalent` is an [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation).
@available(*, unavailable, message="call the 'startsWith()' method on the sequence")
public func startsWith<
S0 : SequenceType, S1 : SequenceType
where
S0.Generator.Element == S1.Generator.Element
>(s: S0, _ prefix: S1,
@noescape _ isEquivalent: (S1.Generator.Element, S1.Generator.Element) -> Bool)
-> Bool
{
fatalError("unavailable function can't be called")
}

/// The `GeneratorType` for `EnumerateSequence`. `EnumerateGenerator`
/// wraps a `Base` `GeneratorType` and yields successive `Int` values,
/// starting at zero, along with the elements of the underlying
Expand Down Expand Up @@ -209,105 +129,3 @@ public struct EnumerateSequence<Base : SequenceType> : SequenceType {
}
}

/// Returns a lazy `SequenceType` containing pairs (*n*, *x*), where
/// *n*s are consecutive `Int`s starting at zero, and *x*s are
/// the elements of `base`:
///
/// > for (n, c) in enumerate("Swift".characters) {
/// print("\(n): '\(c)'" )
/// }
/// 0: 'S'
/// 1: 'w'
/// 2: 'i'
/// 3: 'f'
/// 4: 't'
@available(*, unavailable, message="call the 'enumerate()' method on the sequence")
public func enumerate<Seq : SequenceType>(
base: Seq
) -> EnumerateSequence<Seq> {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `a1` and `a2` contain the same elements in the
/// same order.
@available(*, unavailable, message="call the 'equalElements()' method on the sequence")
public func equal<
S1 : SequenceType, S2 : SequenceType
where
S1.Generator.Element == S2.Generator.Element,
S1.Generator.Element : Equatable
>(a1: S1, _ a2: S2) -> Bool {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `a1` and `a2` contain equivalent elements, using
/// `isEquivalent` as the equivalence test.
///
/// - Requires: `isEquivalent` is an [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation).
@available(*, unavailable, message="call the 'equalElements()' method on the sequence")
public func equal<
S1 : SequenceType, S2 : SequenceType
where
S1.Generator.Element == S2.Generator.Element
>(a1: S1, _ a2: S2,
@noescape _ isEquivalent: (S1.Generator.Element, S1.Generator.Element) -> Bool)
-> Bool {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `a1` precedes `a2` in a lexicographical ("dictionary")
/// ordering, using "<" as the comparison between elements.
@available(*, unavailable, message="call the 'lexicographicalCompare()' method on the sequence")
public func lexicographicalCompare<
S1 : SequenceType, S2 : SequenceType
where
S1.Generator.Element == S2.Generator.Element,
S1.Generator.Element : Comparable>(
a1: S1, _ a2: S2) -> Bool {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `a1` precedes `a2` in a lexicographical ("dictionary")
/// ordering, using `isOrderedBefore` as the comparison between elements.
///
/// - Requires: `isOrderedBefore` is a
/// [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
/// over the elements of `a1` and `a2`.
@available(*, unavailable, message="call the 'lexicographicalCompare()' method on the sequence")
public func lexicographicalCompare<
S1 : SequenceType, S2 : SequenceType
where
S1.Generator.Element == S2.Generator.Element
>(
a1: S1, _ a2: S2,
@noescape isOrderedBefore less: (S1.Generator.Element, S1.Generator.Element)
-> Bool
) -> Bool {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff an element in `seq` satisfies `predicate`.
@available(*, unavailable, message="call the 'contains()' method on the sequence")
public func contains<
S : SequenceType, L : BooleanType
>(seq: S, @noescape _ predicate: (S.Generator.Element) -> L) -> Bool {
fatalError("unavailable function can't be called")
}

/// Returns `true` iff `x` is in `seq`.
@available(*, unavailable, message="call the 'contains()' method on the sequence")
public func contains<
S : SequenceType where S.Generator.Element : Equatable
>(seq: S, _ x: S.Generator.Element) -> Bool {
fatalError("unavailable function can't be called")
}

/// Returns the result of repeatedly calling `combine` with an
/// accumulated value initialized to `initial` and each element of
/// `sequence`, in turn.
@available(*, unavailable, message="call the 'reduce()' method on the sequence")
public func reduce<S : SequenceType, U>(
sequence: S, _ initial: U, @noescape _ combine: (U, S.Generator.Element) -> U
) -> U {
fatalError("unavailable function can't be called")
}
14 changes: 0 additions & 14 deletions stdlib/public/core/Arrays.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ ${SelfDocComment}
public struct ${Self}<Element>
: CollectionType, MutableCollectionType, _DestructorSafeContainer {

@available(*, unavailable, renamed="Element")
public typealias T = Element

%if Self == 'ArraySlice':
/// The position of the first element in a non-empty collection.
///
Expand Down Expand Up @@ -765,17 +762,6 @@ extension ${Self} : _ArrayType {
}
}

/// Returns a copy of `self` that has been sorted according to
/// `isOrderedBefore`.
///
/// - Requires: `isOrderedBefore` induces a
/// [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
/// over the elements.
@available(*, unavailable, message="call the 'sort()' method on the array")
public func sorted(isOrderedBefore: (Element, Element) -> Bool) -> ${Self} {
fatalError("unavailable function can't be called")
}

@warn_unused_result
public func _copyToNativeArrayBuffer() -> _ContiguousArrayBuffer<Element> {
return _extractOrCopyToNativeArrayBuffer(self._buffer)
Expand Down
3 changes: 0 additions & 3 deletions stdlib/public/core/BridgeObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,6 @@ internal var _nilNativeObject: AnyObject? {
public struct AutoreleasingUnsafeMutablePointer<Memory /* TODO : class */>
: Equatable, NilLiteralConvertible, _PointerType {

@available(*, unavailable, renamed="Memory")
public typealias T = Memory

public let _rawValue: Builtin.RawPointer

@_transparent
Expand Down
7 changes: 0 additions & 7 deletions stdlib/public/core/CTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,6 @@ public func ==(lhs: COpaquePointer, rhs: COpaquePointer) -> Bool {
return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
}

/// The family of C function pointer types.
///
/// This type has been removed. Instead of `CFunctionType<(T) -> U>`, a native
/// function type with the C convention can be used, `@convention(c) (T) -> U`.
@available(*, unavailable, message="use a function type '@convention(c) (T) -> U'")
public struct CFunctionPointer<T> {}

/// The corresponding Swift type to `va_list` in imported C APIs.
public struct CVaListPointer {
var value: UnsafeMutablePointer<Void>
Expand Down
Loading