122 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface IDELogNavigator4{5 id selectedObjects;6}7@end8 9@interface IDELogNavigator (CAT)10 @property (readwrite, retain) id selectedObjects; // expected-note {{property declared here}}11 @property (readwrite, retain) id d_selectedObjects; // expected-note {{property declared here}}12@end13 14@implementation IDELogNavigator 15@synthesize selectedObjects = _selectedObjects; // expected-error {{property declared in category 'CAT' cannot be implemented in class implementation}}16@dynamic d_selectedObjects; // expected-error {{property declared in category 'CAT' cannot be implemented in class implementation}}17@end18 19// Test120@interface NSArray 21- (int)count;22@end23 24@protocol MyCountable25@property (readonly) int count;26@end27 28 29@interface NSArray(Additions) <MyCountable>30@end31 32@implementation NSArray(Additions)33@end34 35// Test236@protocol NSProtocol37- (int)count;38@end39 40@interface NSArray1 <NSProtocol>41@end42 43@interface NSArray1(Additions) <MyCountable>44@end45 46@implementation NSArray1(Additions)47@end48 49// Test350@interface Super <NSProtocol>51@end52 53@interface NSArray2 : Super @end54 55@interface NSArray2(Additions) <MyCountable>56@end57 58@implementation NSArray2(Additions)59@end60 61// Test362@interface Super1 <NSProtocol>63@property (readonly) int count;64@end65 66@protocol MyCountable167@end68 69@interface NSArray3 : Super1 <MyCountable1>70@end71 72@implementation NSArray373@end74 75// Test476@interface I77@property int d1;78@end79 80@interface I(CAT)81@property int d1;82@end83 84@implementation I(CAT)85@end86 87// Test5 88@interface C @end89 90@interface C (CAT)91- (int) p;92@end93 94 95@interface C (Category)96@property (readonly) int p; // no warning for this property - a getter is declared in another category97@property (readonly) int p1; // expected-note {{property declared here}}98@property (readonly) int p2; // no warning for this property - a getter is declared in this category99- (int) p2;100@end101 102@implementation C (Category) // expected-warning {{property 'p1' requires method 'p1' to be defined - use @dynamic or provide a method implementation in this category}}103@end104 105// Test6106@protocol MyProtocol107@property (readonly) float anotherFloat; // expected-note {{property declared here}}108@property (readonly) float Float; // no warning for this property - a getter is declared in this protocol109- (float) Float;110@end111 112@interface MyObject 113{ float anotherFloat; }114@end115 116@interface MyObject (CAT) <MyProtocol>117@end118 119@implementation MyObject (CAT) // expected-warning {{property 'anotherFloat' requires method 'anotherFloat' to be defined - use @dynamic or provide a method implementation in this category}}120@end121 122