@@ -776,20 +776,22 @@ func anyToAny<T, U>(_ a: T, _ : U.Type) -> U {
776
776
ErrorBridgingTests . test ( " error-to-NSObject casts " ) {
777
777
let error = MyCustomizedError ( code: 12345 )
778
778
779
- // Unconditional cast
780
- let nsErrorAsObject1 = unconditionalCast ( error, to: NSObject . self)
781
- let nsError1 = unconditionalCast ( nsErrorAsObject1, to: NSError . self)
782
- expectEqual ( " custom " , nsError1. domain)
783
- expectEqual ( 12345 , nsError1. code)
784
-
785
- // Conditional cast
786
- let nsErrorAsObject2 = conditionalCast ( error, to: NSObject . self) !
787
- let nsError2 = unconditionalCast ( nsErrorAsObject2, to: NSError . self)
788
- expectEqual ( " custom " , nsError2. domain)
789
- expectEqual ( 12345 , nsError2. code)
790
-
791
- // "is" check
792
- expectTrue ( error is NSObject )
779
+ if #available( macOS 9999 , iOS 9999 , tvOS 9999 , watchOS 9999 , * ) {
780
+ // Unconditional cast
781
+ let nsErrorAsObject1 = unconditionalCast ( error, to: NSObject . self)
782
+ let nsError1 = unconditionalCast ( nsErrorAsObject1, to: NSError . self)
783
+ expectEqual ( " custom " , nsError1. domain)
784
+ expectEqual ( 12345 , nsError1. code)
785
+
786
+ // Conditional cast
787
+ let nsErrorAsObject2 = conditionalCast ( error, to: NSObject . self) !
788
+ let nsError2 = unconditionalCast ( nsErrorAsObject2, to: NSError . self)
789
+ expectEqual ( " custom " , nsError2. domain)
790
+ expectEqual ( 12345 , nsError2. code)
791
+
792
+ // "is" check
793
+ expectTrue ( error is NSObject )
794
+ }
793
795
}
794
796
795
797
runAllTests ( )
0 commit comments