1 | // RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s |
2 | |
3 | // This test case shows that 'availability' and 'deprecated' do not inherit |
4 | // when a property is redeclared in a subclass. This is intentional. |
5 | |
6 | @interface NSObject @end |
7 | @protocol myProtocol |
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}} |
10 | @end |
11 | |
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}} |
15 | @end |
16 | |
17 | @interface Bar : Foo <myProtocol> |
18 | @property int myProperty; |
19 | @property int myProtocolProperty; |
20 | @end |
21 | |
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}} |
25 | |
26 | x.myProperty = 1; // no-warning |
27 | (void)[x myProperty]; // no-warning |
28 | |
29 | x.myProtocolProperty = 0; // no-warning |
30 | |
31 | (void)[x myProtocolProperty]; // no-warning |
32 | (void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in macOS 10.8}} |
33 | } |
34 | |