Skip to content

Marking .abs() method for floating point types as obsolete in Swift 4 #5810

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

Merged
merged 2 commits into from
Nov 16, 2016
Merged
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
5 changes: 3 additions & 2 deletions stdlib/public/SDK/CoreGraphics/CGFloat.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ extension CGFloat {
fatalError("unavailable")
}

@available(*, unavailable, message: "Please use the `abs(_:)` free function")
@available(swift, deprecated: 3.1, obsoleted: 4.0, message: "Please use the `abs(_:)` free function")
@_transparent
public static func abs(_ x: CGFloat) -> CGFloat {
fatalError("unavailable")
return x.magnitude
}
}

Expand Down
5 changes: 3 additions & 2 deletions stdlib/public/core/FloatingPointTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,10 @@ public postfix func -- (lhs: inout ${Self}) -> ${Self} {
}

extension ${Self} {
@available(*, unavailable, message: "Please use the `abs(_:)` free function")
@available(swift, deprecated: 3.1, obsoleted: 4.0, message: "Please use the `abs(_:)` free function")
@_transparent
public static func abs(_ x: ${Self}) -> ${Self} {
fatalError("unavailable")
return x.magnitude
}
}

Expand Down
6 changes: 0 additions & 6 deletions test/api-digester/source-stability.swift.expected
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@ Protocol MutableIndexable has been removed (deprecated)
Protocol RandomAccessIndexable has been removed (deprecated)
Protocol RangeReplaceableIndexable has been removed (deprecated)

/* Moved declarations */
// rdar://28456614 Swift 3 breaking change: static function 'abs' removed from Double/Float/Float80/CGFloat
Func Double.abs(_:) has been moved to Func abs(_:)
Func Float.abs(_:) has been moved to Func abs(_:)
Func Float80.abs(_:) has been moved to Func abs(_:)

/* Function type change */
Func UnsafePointer.withMemoryRebound(to:capacity:_:) has 3rd parameter type change from (UnsafeMutablePointer<T>) throws -> Result to (UnsafePointer<T>) throws -> Result