From e07b39453b883f554f1154eedeecd948c11d5888 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 18 Sep 2020 16:01:11 -0400 Subject: [PATCH] Swap availability for #if check on Float16. --- Sources/RealModule/Float16+Real.swift | 4 +--- Sources/_TestSupport/RealTestSupport.swift | 4 +--- Tests/RealTests/ElementaryFunctionChecks.swift | 2 +- Tests/RealTests/IntegerExponentTests.swift | 7 +++---- Tests/WindowsMain.swift | 4 ++-- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Sources/RealModule/Float16+Real.swift b/Sources/RealModule/Float16+Real.swift index 00f2a90..2e30d0e 100644 --- a/Sources/RealModule/Float16+Real.swift +++ b/Sources/RealModule/Float16+Real.swift @@ -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 { diff --git a/Sources/_TestSupport/RealTestSupport.swift b/Sources/_TestSupport/RealTestSupport.swift index 3e65fdb..aad1b23 100644 --- a/Sources/_TestSupport/RealTestSupport.swift +++ b/Sources/_TestSupport/RealTestSupport.swift @@ -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 diff --git a/Tests/RealTests/ElementaryFunctionChecks.swift b/Tests/RealTests/ElementaryFunctionChecks.swift index b72aa04..03b7ba5 100644 --- a/Tests/RealTests/ElementaryFunctionChecks.swift +++ b/Tests/RealTests/ElementaryFunctionChecks.swift @@ -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() diff --git a/Tests/RealTests/IntegerExponentTests.swift b/Tests/RealTests/IntegerExponentTests.swift index 3ddf627..09702b5 100644 --- a/Tests/RealTests/IntegerExponentTests.swift +++ b/Tests/RealTests/IntegerExponentTests.swift @@ -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() @@ -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() } diff --git a/Tests/WindowsMain.swift b/Tests/WindowsMain.swift index fd04ec7..d7431c4 100644 --- a/Tests/WindowsMain.swift +++ b/Tests/WindowsMain.swift @@ -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), @@ -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),