@@ -167,8 +167,8 @@ public extension AvailableOnMacCatalyst { } // ok
167
167
168
168
@available ( iOS, introduced: 14.0 )
169
169
@available ( macCatalyst, introduced: 14.5 )
170
- public struct AvailableLaterOnMacCatalyst { // expected-note {{enclosing scope requires availability of Mac Catalyst 14.5 or newer}}
171
- @available ( iOS, introduced: 14.0 ) // expected-warning {{instance method cannot be more available than enclosing scope}}
170
+ public struct AvailableLaterOnMacCatalyst { // expected-note 2 {{enclosing scope requires availability of Mac Catalyst 14.5 or newer}}
171
+ @available ( iOS, introduced: 14.0 ) // expected-error {{instance method cannot be more available than enclosing scope}}
172
172
func iOSOnly( ) { }
173
173
174
174
@available ( macCatalyst, introduced: 14.5 )
@@ -177,4 +177,43 @@ public struct AvailableLaterOnMacCatalyst { // expected-note {{enclosing scope r
177
177
@available ( iOS, introduced: 14.0 )
178
178
@available ( macCatalyst, introduced: 14.5 )
179
179
func iOSAndMacCatalyst( ) { }
180
+
181
+ struct Nested {
182
+ @available ( iOS, introduced: 14.0 ) // expected-error {{instance method cannot be more available than enclosing scope}}
183
+ func iOSOnlyNested( ) { }
184
+
185
+ @available ( macCatalyst, introduced: 14.5 )
186
+ func macCatalystOnlyNested( ) { }
187
+
188
+ @available ( iOS, introduced: 14.0 )
189
+ @available ( macCatalyst, introduced: 14.5 )
190
+ func iOSAndMacCatalystNested( ) { }
191
+ }
192
+ }
193
+
194
+ @available ( iOS, introduced: 14.0 )
195
+ @available ( macCatalyst, introduced: 14.5 )
196
+ extension AvailableLaterOnMacCatalyst { // expected-note 2 {{enclosing scope requires availability of Mac Catalyst 14.5 or newer}}
197
+ @available ( iOS, introduced: 14.0 ) // expected-error {{instance method cannot be more available than enclosing scope}}
198
+ func iOSOnlyInExtension( ) { }
199
+
200
+ @available ( macCatalyst, introduced: 14.5 )
201
+ func macCatalystOnlyInExtension( ) { }
202
+
203
+ @available ( iOS, introduced: 14.0 )
204
+ @available ( macCatalyst, introduced: 14.5 )
205
+ func iOSAndMacCatalystInExtension( ) { }
206
+
207
+ struct NestedInExtension {
208
+ @available ( iOS, introduced: 14.0 ) // expected-warning {{instance method cannot be more available than enclosing scope}}
209
+ func iOSOnlyNestedInExtension( ) { }
210
+
211
+ @available ( macCatalyst, introduced: 14.5 )
212
+ func macCatalystOnlyNestedInExtension( ) { }
213
+
214
+ @available ( iOS, introduced: 14.0 )
215
+ @available ( macCatalyst, introduced: 14.5 )
216
+ func iOSAndMacCatalystNestedInExtension( ) { }
217
+ }
218
+
180
219
}
0 commit comments