@@ -532,3 +532,47 @@ func available_func_call_extension_methods(_ e: ExtendMe) { // expected-note {{a
532532 e. osx_app_extension_extension_osx_future_method ( ) // expected-error {{'osx_app_extension_extension_osx_future_method()' is only available in macOS 99 or newer}}
533533 // expected-note@-1 {{add 'if #available' version check}}
534534}
535+
536+ @available ( OSX, unavailable)
537+ @available ( OSX, introduced: 99 )
538+ struct OSXUnavailableAndIntroducedInFuture { }
539+
540+ @available ( OSX, unavailable, introduced: 99 )
541+ struct OSXUnavailableAndIntroducedInFutureSameAttribute { }
542+
543+ @available ( OSX, introduced: 99 )
544+ @available ( OSX, unavailable)
545+ struct OSXIntroducedInFutureAndUnavailable { }
546+
547+ @available ( OSX, unavailable)
548+ func osx_unavailable_func(
549+ _ s1: OSXFutureAvailable ,
550+ _ s2: OSXUnavailableAndIntroducedInFuture ,
551+ _ s3: OSXUnavailableAndIntroducedInFutureSameAttribute ,
552+ _ s4: OSXIntroducedInFutureAndUnavailable ,
553+ ) -> (
554+ OSXFutureAvailable ,
555+ OSXUnavailableAndIntroducedInFuture ,
556+ OSXUnavailableAndIntroducedInFutureSameAttribute ,
557+ OSXIntroducedInFutureAndUnavailable
558+ ) {
559+ _ = OSXFutureAvailable ( ) // expected-error {{'OSXFutureAvailable' is only available in macOS 99 or newer}}
560+ // expected-note@-1 {{add 'if #available' version check}}
561+ // FIXME: [availability] The following diagnostic is incorrect
562+ _ = OSXUnavailableAndIntroducedInFuture ( ) // expected-error {{'OSXUnavailableAndIntroducedInFuture' is only available in macOS 99 or newer}}
563+ // expected-note@-1 {{add 'if #available' version check}}
564+ _ = OSXUnavailableAndIntroducedInFutureSameAttribute ( )
565+ _ = OSXIntroducedInFutureAndUnavailable ( )
566+
567+ func takesType< T> ( _ t: T . Type ) { }
568+ takesType ( OSXFutureAvailable . self) // expected-error {{'OSXFutureAvailable' is only available in macOS 99 or newer}}
569+ // expected-note@-1 {{add 'if #available' version check}}
570+ // FIXME: [availability] The following diagnostic is incorrect
571+ takesType ( OSXUnavailableAndIntroducedInFuture . self) // expected-error {{'OSXUnavailableAndIntroducedInFuture' is only available in macOS 99 or newer}}
572+ // expected-note@-1 {{add 'if #available' version check}}
573+ takesType ( OSXUnavailableAndIntroducedInFutureSameAttribute . self)
574+ takesType ( OSXIntroducedInFutureAndUnavailable . self)
575+
576+ return ( s1, s2, s3, s4)
577+ }
578+
0 commit comments