xref: /llvm-project/clang/test/SemaObjC/property-impl-misuse.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3@interface I {
4  int Y;
5}
6@property int X;
7@property int Y;
8@property int Z;
9@end
10
11@implementation I
12@dynamic X; // expected-note {{previous declaration is here}}
13@dynamic X; // expected-error {{property 'X' is already implemented}}
14@synthesize Y; // expected-note {{previous use is here}}
15@synthesize Z=Y; // expected-error {{synthesized properties 'Z' and 'Y' both claim instance variable 'Y'}}
16@end
17
18@interface IDEPathCell
19{
20@private
21    id _gradientStyle;
22}
23
24@property (readwrite, assign, nonatomic) id gradientStyle;
25@end
26
27@implementation IDEPathCell
28
29@synthesize gradientStyle = _gradientStyle;
30- (void)setGradientStyle:(id)value { }
31
32+ (id)_componentCellWithRepresentedObject {
33    return self.gradientStyle;
34}
35@end
36
37@interface rdar11054153
38@property int P; // expected-error {{type of property 'P' ('int') does not match type of accessor 'P' ('void')}}
39- (void)P; // expected-note {{declared here}}
40
41@property int P1; // expected-warning {{type of property 'P1' does not match type of accessor 'P1'}}
42- (double) P1; // expected-note {{declared here}}
43
44@property int P2; // expected-error {{type of property 'P2' ('int') does not match type of accessor 'P2' ('double *')}}
45- (double*)P2; // expected-note {{declared here}}
46
47@end
48