2013-04-05 01:58:30 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s
|
|
|
|
|
2013-12-06 00:25:25 +08:00
|
|
|
// This test case shows that 'availability' and 'deprecated' do not inherit
|
2013-04-05 01:58:30 +08:00
|
|
|
// when a property is redeclared in a subclass. This is intentional.
|
|
|
|
|
|
|
|
@interface NSObject @end
|
|
|
|
@protocol myProtocol
|
2013-12-19 07:30:06 +08:00
|
|
|
@property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{'myProtocolProperty' has been explicitly marked deprecated here}} \
|
2013-04-06 08:34:27 +08:00
|
|
|
// expected-note {{property 'myProtocolProperty' is declared deprecated here}}
|
2013-04-05 01:58:30 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Foo : NSObject
|
2013-12-19 07:30:06 +08:00
|
|
|
@property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note 2 {{'myProperty' has been explicitly marked deprecated here}} \
|
2013-04-05 01:58:30 +08:00
|
|
|
// expected-note {{property 'myProperty' is declared deprecated here}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Bar : Foo <myProtocol>
|
2013-04-06 08:34:27 +08:00
|
|
|
@property int myProperty;
|
|
|
|
@property int myProtocolProperty;
|
2013-04-05 01:58:30 +08:00
|
|
|
@end
|
|
|
|
|
2013-04-06 08:34:27 +08:00
|
|
|
void test(Foo *y, Bar *x, id<myProtocol> z) {
|
2016-06-29 04:55:30 +08:00
|
|
|
y.myProperty = 0; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
|
|
|
|
(void)[y myProperty]; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
|
2013-04-05 01:58:30 +08:00
|
|
|
|
|
|
|
x.myProperty = 1; // no-warning
|
2014-07-19 06:59:10 +08:00
|
|
|
(void)[x myProperty]; // no-warning
|
2013-04-05 01:58:30 +08:00
|
|
|
|
|
|
|
x.myProtocolProperty = 0; // no-warning
|
|
|
|
|
2014-07-19 06:59:10 +08:00
|
|
|
(void)[x myProtocolProperty]; // no-warning
|
2016-06-29 04:55:30 +08:00
|
|
|
(void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in macOS 10.8}}
|
2013-04-05 01:58:30 +08:00
|
|
|
}
|