| 1 |
// RUN: %clang_cc1 -triple arm64-apple-ios11 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
@protocol P |
| 4 |
|
| 5 |
@property (nonatomic) int reqProp __attribute__((availability(ios, introduced=12.0))); // expected-note 2 {{is here}} |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
@optional |
| 10 |
@property (nonatomic) int myProp __attribute__((availability(ios, introduced=12.0))); // expected-note {{has been marked as being introduced in}} |
| 11 |
|
| 12 |
@optional |
| 13 |
@property (nonatomic, readonly) int depProp __attribute__((availability(ios, introduced=8.0, deprecated=12.0))); // expected-note {{protocol method is here}} |
| 14 |
|
| 15 |
@optional |
| 16 |
@property (nonatomic) int obsProp __attribute__((availability(ios, introduced=8.0, obsoleted=12.0))); |
| 17 |
|
| 18 |
@optional |
| 19 |
- (void) unavaibleInClass __attribute__((availability(ios, introduced=12.0))); // expected-note {{method is here}} |
| 20 |
|
| 21 |
@end |
| 22 |
|
| 23 |
@interface X <P> |
| 24 |
|
| 25 |
@property (nonatomic) int myProp __attribute__((availability(ios, introduced=13.0))); // expected-note 2 {{has been marked as being introduced in}} |
| 26 |
|
| 27 |
@property (nonatomic) int reqProp __attribute__((availability(ios, introduced=13.0))); // expected-warning 2 {{method introduced after the protocol method it implements on iOS}} |
| 28 |
|
| 29 |
@property (nonatomic, readonly) int depProp __attribute__((availability(ios, introduced=8.0, deprecated=10.0))); // expected-warning {{method deprecated before the protocol method it implements on iOS (12.0 vs. 10.0)}} expected-note {{been explicitly marked deprecated here}} |
| 30 |
|
| 31 |
@property (nonatomic) int obsProp __attribute__((availability(ios, introduced=8.0, obsoleted=10.0))); // expected-note {{been explicitly marked unavailable here}} |
| 32 |
|
| 33 |
- (void) unavaibleInClass __attribute__((availability(ios, unavailable))); // expected-warning {{method cannot be unavailable on iOS when the protocol method it implements is available}} |
| 34 |
|
| 35 |
@end |
| 36 |
|
| 37 |
|
| 38 |
void test(X *x) { |
| 39 |
int i = x.myProp; // expected-warning {{'myProp' is only available on iOS 13.0 or newer}} expected-note {{enclose}} |
| 40 |
x.myProp = i; // expected-warning {{'setMyProp:' is only available on iOS 13.0 or newer}} expected-note {{enclose}} |
| 41 |
int i2 = x.depProp; // expected-warning {{'depProp' is deprecated: first deprecated in iOS 10.0}} |
| 42 |
int i3 = x.obsProp; // expected-error {{'obsProp' is unavailable: obsoleted in iOS 10.0}} |
| 43 |
} |
| 44 |
|
| 45 |
void testProto(id<P> x) { |
| 46 |
int i = x.myProp; // expected-warning {{'myProp' is only available on iOS 12.0 or newer}} expected-note {{enclose}} |
| 47 |
} |