Skip to content

Commit

Permalink
Merge pull request apple#157 from stephentyrone/float16-availability-…
Browse files Browse the repository at this point in the history
…redux

Swap availability for #if check on Float16.
  • Loading branch information
stephentyrone authored Sep 18, 2020
2 parents 3d7462a + e07b394 commit 6b24333
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
4 changes: 1 addition & 3 deletions Sources/RealModule/Float16+Real.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=5.3)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
import _NumericsShims

@available(iOS 14.0, tvOS 14.0, watchOS 7.0, *)
@available(macOS, unavailable)
@available(macCatalyst, unavailable)
extension Float16: Real {
@_transparent
public static func cos(_ x: Float16) -> Float16 {
Expand Down
4 changes: 1 addition & 3 deletions Sources/_TestSupport/RealTestSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ public protocol FixedWidthFloatingPoint: BinaryFloatingPoint
where Exponent: FixedWidthInteger,
RawSignificand: FixedWidthInteger { }

#if swift(>=5.3)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
@available(iOS 14.0, watchOS 14.0, tvOS 7.0, *)
@available(macOS, unavailable)
@available(macCatalyst, unavailable)
extension Float16: FixedWidthFloatingPoint { }
#endif

Expand Down
2 changes: 1 addition & 1 deletion Tests/RealTests/ElementaryFunctionChecks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal extension Real where Self: BinaryFloatingPoint {

final class ElementaryFunctionChecks: XCTestCase {

#if swift(>=5.3) && !os(macOS)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
func testFloat16() {
if #available(iOS 14.0, watchOS 14.0, tvOS 7.0, *) {
Float16.elementaryFunctionChecks()
Expand Down
7 changes: 3 additions & 4 deletions Tests/RealTests/IntegerExponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ internal extension Real where Self: FixedWidthFloatingPoint {
}
}

#if swift(>=5.3)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
@available(iOS 14.0, watchOS 14.0, tvOS 7.0, *)
@available(macOS, unavailable)
extension Float16 {
static func testIntegerExponent() {
testIntegerExponentCommon()
Expand Down Expand Up @@ -174,8 +173,8 @@ extension Double {
}

final class IntegerExponentTests: XCTestCase {

#if swift(>=5.3) && !os(macOS)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
func testFloat16() {
Float16.testIntegerExponent()
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/WindowsMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension RealTests.ApproximateEqualityTests {
])
}

#if swift(>=5.3)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
extension ElementaryFunctionChecks {
static var all = testCase([
("testFloat16", ElementaryFunctionChecks.testFloat16),
Expand All @@ -49,7 +49,7 @@ extension ElementaryFunctionChecks {
}
#endif

#if swift(>=5.3)
#if swift(>=5.3) && !(os(macOS) || os(iOS) && targetEnvironment(macCatalyst))
extension IntegerExponentTests {
static var all = testCase([
("testFloat16", IntegerExponentTests.testFloat16),
Expand Down

0 comments on commit 6b24333

Please sign in to comment.