34 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s2 3// This test case shows that 'availability' and 'deprecated' do not inherit4// when a property is redeclared in a subclass. This is intentional.5 6@interface NSObject @end7@protocol myProtocol8@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@end11 12@interface Foo : NSObject13@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@end16 17@interface Bar : Foo <myProtocol>18@property int myProperty;19@property int myProtocolProperty;20@end21 22void 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-warning27 (void)[x myProperty]; // no-warning28 29 x.myProtocolProperty = 0; // no-warning30 31 (void)[x myProtocolProperty]; // no-warning32 (void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in macOS 10.8}}33}34