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