@@ -193,25 +193,27 @@ ErrorTests.test("test dealloc empty error box") {
193193
194194var errors : [ Error ] = [ ]
195195ErrorTests . test ( " willThrow " ) {
196- // Error isn't allowed in a @convention(c) function when ObjC interop is
197- // not available, so pass it through an OpaquePointer.
198- typealias WillThrow = @convention ( c) ( OpaquePointer ) -> Void
199- let willThrow = pointerToSwiftCoreSymbol ( name: " _swift_willThrow " ) !
200- let callback : WillThrow = {
201- errors. append ( unsafeBitCast ( $0, to: Error . self) )
202- }
203- willThrow. storeBytes ( of: callback, as: WillThrow . self)
204- expectTrue ( errors. isEmpty)
205- do {
206- throw UnsignedError . negativeOne
207- } catch { }
208- expectEqual ( UnsignedError . self, type ( of: errors. last!) )
196+ if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) {
197+ // Error isn't allowed in a @convention(c) function when ObjC interop is
198+ // not available, so pass it through an OpaquePointer.
199+ typealias WillThrow = @convention ( c) ( OpaquePointer ) -> Void
200+ let willThrow = pointerToSwiftCoreSymbol ( name: " _swift_willThrow " ) !
201+ let callback : WillThrow = {
202+ errors. append ( unsafeBitCast ( $0, to: Error . self) )
203+ }
204+ willThrow. storeBytes ( of: callback, as: WillThrow . self)
205+ expectTrue ( errors. isEmpty)
206+ do {
207+ throw UnsignedError . negativeOne
208+ } catch { }
209+ expectEqual ( UnsignedError . self, type ( of: errors. last!) )
209210
210- do {
211- throw SillyError . JazzHands
212- } catch { }
213- expectEqual ( 2 , errors. count)
214- expectEqual ( SillyError . self, type ( of: errors. last!) )
211+ do {
212+ throw SillyError . JazzHands
213+ } catch { }
214+ expectEqual ( 2 , errors. count)
215+ expectEqual ( SillyError . self, type ( of: errors. last!) )
216+ }
215217}
216218
217219runAllTests ( )
0 commit comments