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) {
1964
1964
if (!AttrRange.isContainedIn (*EnclosingAnnotatedRange)) {
1965
1965
// Members of extensions of nominal types with available ranges were
1966
1966
// 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)
1968
1970
? DiagnosticBehavior::Warning
1969
1971
: DiagnosticBehavior::Unspecified;
1970
1972
diagnose (D->isImplicit () ? enclosingDecl->getLoc ()
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ func doSomethingDeprecatedOniOS() { }
81
81
doSomethingDeprecatedOniOS ( ) // okay
82
82
83
83
@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}}
85
85
86
86
@available ( macOS 10 . 10 , * )
87
87
extension 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
107
107
extension TestStruct {
108
108
@available ( macOS 10 . 9 , * ) // expected-warning {{instance method cannot be more available than enclosing scope}}
109
109
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
+ }
110
115
}
111
116
112
117
@available ( macOS 10 . 11 , * )
You can’t perform that action at this time.
0 commit comments