File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1964,7 +1964,9 @@ void AttributeChecker::visitAvailableAttr(AvailableAttr *attr) {
19641964 if (!AttrRange.isContainedIn (*EnclosingAnnotatedRange)) {
19651965 // Members of extensions of nominal types with available ranges were
19661966 // not diagnosed previously, so only emit a warning in that case.
1967- auto limit = (enclosingDecl != parent && isa<ExtensionDecl>(parent))
1967+ bool inExtension = isa<ExtensionDecl>(
1968+ D->getDeclContext ()->getTopmostDeclarationDeclContext ());
1969+ auto limit = (enclosingDecl != parent && inExtension)
19681970 ? DiagnosticBehavior::Warning
19691971 : DiagnosticBehavior::Unspecified;
19701972 diagnose (D->isImplicit () ? enclosingDecl->getLoc ()
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ func doSomethingDeprecatedOniOS() { }
8181doSomethingDeprecatedOniOS ( ) // okay
8282
8383@available ( macOS 10 . 10 , * )
84- struct TestStruct { } // expected-note {{enclosing scope requires availability of macOS 10.10 or newer}}
84+ struct TestStruct { } // expected-note 2 {{enclosing scope requires availability of macOS 10.10 or newer}}
8585
8686@available ( macOS 10 . 10 , * )
8787extension TestStruct { // expected-note {{enclosing scope requires availability of macOS 10.10 or newer}}
@@ -107,6 +107,11 @@ extension TestStruct { // expected-note {{enclosing scope requires availability
107107extension TestStruct {
108108 @available ( macOS 10 . 9 , * ) // expected-warning {{instance method cannot be more available than enclosing scope}}
109109 func doFifthThing( ) { }
110+
111+ struct NestedStruct {
112+ @available ( macOS 10 . 9 , * ) // expected-warning {{instance method cannot be more available than enclosing scope}}
113+ func doSixthThing( ) { }
114+ }
110115}
111116
112117@available ( macOS 10 . 11 , * )
You can’t perform that action at this time.
0 commit comments