File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -1903,11 +1903,14 @@ void AttributeChecker::visitAvailableAttr(AvailableAttr *attr) {
19031903
19041904 if (EnclosingDecl) {
19051905 if (EnclosingDeclIsUnavailable) {
1906- diagnose (D->isImplicit () ? EnclosingDecl->getLoc () : attr->getLocation (),
1907- diag::availability_decl_more_than_unavailable_enclosing,
1908- D->getDescriptiveKind ());
1909- diagnose (EnclosingDecl->getLoc (),
1910- diag::availability_decl_more_than_unavailable_enclosing_here);
1906+ if (!AttrRange.isKnownUnreachable ()) {
1907+ diagnose (D->isImplicit () ? EnclosingDecl->getLoc ()
1908+ : attr->getLocation (),
1909+ diag::availability_decl_more_than_unavailable_enclosing,
1910+ D->getDescriptiveKind ());
1911+ diagnose (EnclosingDecl->getLoc (),
1912+ diag::availability_decl_more_than_unavailable_enclosing_here);
1913+ }
19111914 } else if (!AttrRange.isContainedIn (EnclosingAnnotatedRange.value ())) {
19121915 diagnose (D->isImplicit () ? EnclosingDecl->getLoc () : attr->getLocation (),
19131916 diag::availability_decl_more_than_enclosing,
Original file line number Diff line number Diff line change @@ -625,6 +625,12 @@ class ClassAvailableOn10_51 { // expected-note {{enclosing scope requires availa
625625 @available ( OSX, introduced: 10.9 ) // expected-error {{instance method cannot be more available than enclosing scope}}
626626 func someMethodAvailableOn10_9( ) { }
627627
628+ @available ( OSX, unavailable)
629+ func someMethodUnavailable( ) { }
630+
631+ @available ( * , unavailable)
632+ func someMethodUniversallyUnavailable( ) { }
633+
628634 @available ( OSX, introduced: 10.52 )
629635 var propWithGetter : Int { // expected-note{{enclosing scope requires availability of macOS 10.52 or newer}}
630636 @available ( OSX, introduced: 10.51 ) // expected-error {{getter cannot be more available than enclosing scope}}
Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ extension Outer {
129129 func osx_more_available_but_still_unavailable_call_osx( ) {
130130 osx ( ) // OK
131131 }
132+
133+ @available ( OSX, unavailable)
134+ func osx_double_unavailable_call_osx( ) {
135+ osx ( ) // OK
136+ }
137+
138+ @available ( * , unavailable)
139+ func osx_universally_unavailable_call_osx( ) {
140+ osx ( ) // OK
141+ }
132142
133143 // rdar://92551870
134144 func osx_call_osx_more_available_but_still_unavailable( ) {
You can’t perform that action at this time.
0 commit comments