| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
__attribute__((objc_root_class)) |
| 4 |
@interface RootClass |
| 5 |
|
| 6 |
- (void)baseMethod; |
| 7 |
|
| 8 |
@end |
| 9 |
|
| 10 |
__attribute__((objc_direct_members)) |
| 11 |
@interface I : RootClass |
| 12 |
|
| 13 |
- (void)direct; // expected-note {{direct member declared here}} |
| 14 |
|
| 15 |
@end |
| 16 |
|
| 17 |
@protocol P |
| 18 |
- (void)direct; |
| 19 |
@end |
| 20 |
|
| 21 |
@interface I (Cat1) <P> // expected-error {{category 'Cat1' cannot conform to protocol 'P' because of direct members declared in interface 'I'}} |
| 22 |
@end |
| 23 |
|
| 24 |
@protocol BaseP |
| 25 |
- (void)baseMethod; |
| 26 |
@end |
| 27 |
|
| 28 |
@interface I (CatBase) <BaseP> // OK |
| 29 |
@end |
| 30 |
|
| 31 |
@protocol P2 |
| 32 |
- (void)indirect; |
| 33 |
@end |
| 34 |
|
| 35 |
@interface I (Cat2) <P2> // OK |
| 36 |
- (void)indirect; |
| 37 |
@end |
| 38 |
|
| 39 |
@protocol P3 |
| 40 |
- (void)indirect3; |
| 41 |
@end |
| 42 |
|
| 43 |
@interface I (Cat3) <P3> // OK |
| 44 |
@end |
| 45 |
|
| 46 |
@interface ExpDirect : RootClass |
| 47 |
|
| 48 |
- (void)direct __attribute__((objc_direct)); // expected-note {{direct member declared here}} |
| 49 |
|
| 50 |
- (void)directRecursive __attribute__((objc_direct)); // expected-note {{direct member declared here}} |
| 51 |
|
| 52 |
@end |
| 53 |
|
| 54 |
@interface ExpDirect (CatExpDirect) <P> // expected-error {{category 'CatExpDirect' cannot conform to protocol 'P' because of direct members declared in interface 'ExpDirect'}} |
| 55 |
@end |
| 56 |
|
| 57 |
@protocol PRecursive1 |
| 58 |
- (void)directRecursive; |
| 59 |
@end |
| 60 |
|
| 61 |
@protocol PRecursiveTop <PRecursive1> |
| 62 |
@end |
| 63 |
|
| 64 |
@interface ExpDirect () <PRecursiveTop> // expected-error {{class extension cannot conform to protocol 'PRecursive1' because of direct members declared in interface 'ExpDirect'}} |
| 65 |
@end |
| 66 |
|
| 67 |
|
| 68 |
@protocol PProp |
| 69 |
|
| 70 |
@property (nonatomic, readonly) I *name; |
| 71 |
|
| 72 |
@end |
| 73 |
|
| 74 |
__attribute__((objc_direct_members)) |
| 75 |
@interface IProp1 : RootClass |
| 76 |
|
| 77 |
@property (nonatomic, readonly) I *name; // expected-note {{direct member declared here}} |
| 78 |
|
| 79 |
@end |
| 80 |
|
| 81 |
@interface IProp1 () <PProp> // expected-error {{class extension cannot conform to protocol 'PProp' because of direct members declared in interface 'IProp1'}} |
| 82 |
@end |
| 83 |
|
| 84 |
|
| 85 |
@protocol PProp2 |
| 86 |
|
| 87 |
@property (nonatomic, readonly, class) I *name; |
| 88 |
|
| 89 |
@end |
| 90 |
|
| 91 |
@interface IProp2 : RootClass |
| 92 |
|
| 93 |
@property (nonatomic, readonly, class, direct) I *name; // expected-note {{direct member declared here}} |
| 94 |
|
| 95 |
@end |
| 96 |
|
| 97 |
@interface IProp2 () <PProp2> // expected-error {{class extension cannot conform to protocol 'PProp2' because of direct members declared in interface 'IProp2'}} |
| 98 |
@end |