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) {
1903
1903
1904
1904
if (EnclosingDecl) {
1905
1905
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
+ }
1911
1914
} else if (!AttrRange.isContainedIn (EnclosingAnnotatedRange.value ())) {
1912
1915
diagnose (D->isImplicit () ? EnclosingDecl->getLoc () : attr->getLocation (),
1913
1916
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
625
625
@available ( OSX, introduced: 10.9 ) // expected-error {{instance method cannot be more available than enclosing scope}}
626
626
func someMethodAvailableOn10_9( ) { }
627
627
628
+ @available ( OSX, unavailable)
629
+ func someMethodUnavailable( ) { }
630
+
631
+ @available ( * , unavailable)
632
+ func someMethodUniversallyUnavailable( ) { }
633
+
628
634
@available ( OSX, introduced: 10.52 )
629
635
var propWithGetter : Int { // expected-note{{enclosing scope requires availability of macOS 10.52 or newer}}
630
636
@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 {
129
129
func osx_more_available_but_still_unavailable_call_osx( ) {
130
130
osx ( ) // OK
131
131
}
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
+ }
132
142
133
143
// rdar://92551870
134
144
func osx_call_osx_more_available_but_still_unavailable( ) {
You can’t perform that action at this time.
0 commit comments