1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3@interface IDELogNavigator
4{
5  id selectedObjects;
6}
7@end
8
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@end
13
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@end
18
19
20// rdar://13713098
21// Test1
22@interface NSArray
23- (int)count;
24@end
25
26@protocol MyCountable
27@property  (readonly) int count;
28@end
29
30
31@interface NSArray(Additions) <MyCountable>
32@end
33
34@implementation NSArray(Additions)
35@end
36
37// Test2
38@protocol NSProtocol
39- (int)count;
40@end
41
42@interface NSArray1 <NSProtocol>
43@end
44
45@interface NSArray1(Additions) <MyCountable>
46@end
47
48@implementation NSArray1(Additions)
49@end
50
51// Test3
52@interface Super <NSProtocol>
53@end
54
55@interface NSArray2 : Super @end
56
57@interface NSArray2(Additions) <MyCountable>
58@end
59
60@implementation NSArray2(Additions)
61@end
62
63// Test3
64@interface Super1 <NSProtocol>
65@property  (readonly) int count;
66@end
67
68@protocol MyCountable1
69@end
70
71@interface NSArray3 : Super1 <MyCountable1>
72@end
73
74@implementation NSArray3
75@end
76
77// Test4
78@interface I
79@property int d1;
80@end
81
82@interface I(CAT)
83@property int d1;
84@end
85
86@implementation I(CAT)
87@end
88
89// Test5
90@interface C @end
91
92@interface C (CAT)
93- (int) p;
94@end
95
96
97@interface C (Category)
98@property (readonly) int p;  // no warning for this property - a getter is declared in another category
99@property (readonly) int p1; // expected-note {{property declared here}}
100@property (readonly) int p2;  // no warning for this property - a getter is declared in this category
101- (int) p2;
102@end
103
104@implementation C (Category)  // expected-warning {{property 'p1' requires method 'p1' to be defined - use @dynamic or provide a method implementation in this category}}
105@end
106
107// Test6
108@protocol MyProtocol
109@property (readonly) float  anotherFloat; // expected-note {{property declared here}}
110@property (readonly) float  Float; // no warning for this property - a getter is declared in this protocol
111- (float) Float;
112@end
113
114@interface MyObject
115{ float anotherFloat; }
116@end
117
118@interface MyObject (CAT) <MyProtocol>
119@end
120
121@implementation MyObject (CAT) // expected-warning {{property 'anotherFloat' requires method 'anotherFloat' to be defined - use @dynamic or provide a method implementation in this category}}
122@end
123
124