1 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s
3 // This test case shows that 'availability' and 'deprecated' do not inherit
4 // when a property is redeclared in a subclass. This is intentional.
6 @interface NSObject @end
8 @property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{'myProtocolProperty' has been explicitly marked deprecated here}} \
9 // expected-note {{property 'myProtocolProperty' is declared deprecated here}}
12 @interface Foo : NSObject
13 @property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note 2 {{'myProperty' has been explicitly marked deprecated here}} \
14 // expected-note {{property 'myProperty' is declared deprecated here}}
17 @interface Bar : Foo <myProtocol>
18 @property int myProperty;
19 @property int myProtocolProperty;
22 void test(Foo *y, Bar *x, id<myProtocol> z) {
23 y.myProperty = 0; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
24 (void)[y myProperty]; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
26 x.myProperty = 1; // no-warning
27 (void)[x myProperty]; // no-warning
29 x.myProtocolProperty = 0; // no-warning
31 (void)[x myProtocolProperty]; // no-warning
32 (void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in macOS 10.8}}