1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
4 @property(readonly) int x;
5 @property(readonly) int y;
6 @property(readonly) int z;
7 -(void) setY: (int) y0;
11 -(void) setX: (int) a0;
18 -(void) setY: (int) y0{}
23 self.z = 2; // expected-error {{assignment to readonly property}}
27 // Test when property is 'readonly' but it has a setter in
28 // its implementation only.
31 @property(readonly) int identifier;
37 - (void)setIdentifier:(int)ident {}
39 - (id)initWithIdentifier:(int)Arg {
46 // Also in a category implementation
48 @property(readonly) int rprop;
52 @implementation I1(CAT)
54 - (void)setRprop:(int)ident {}
56 - (id)initWithIdentifier:(int)Arg {
69 @interface Subclass : Root
73 - (void) setSetterOnly:(int)value;
76 @implementation Subclass
77 - (void) setSetterOnly:(int)value {
85 - (void)setFoo:(int)value;
92 g(c.Foo); // expected-error {{no getter method for read from property}}
98 Subclass *x = [[Subclass alloc] init];
100 x.setterOnly = 4; // OK
106 @interface rdar11363363
110 @property (copy) id p;
111 @property (copy) id r;
112 @property (copy) id Q;
113 @property (copy) id t; // expected-note 2 {{property declared here}}
114 @property (copy) id T; // expected-note 2 {{property declared here}}
115 @property (copy) id Pxyz; // expected-note 2 {{property declared here}}
116 @property (copy) id pxyz; // expected-note 2 {{property declared here}}
119 @implementation rdar11363363
124 @synthesize Pxyz, pxyz;
126 self.P = 0; // expected-warning {{property 'P' not found on object of type 'rdar11363363 *'; did you mean to access property p?}}
127 self.q = 0; // expected-warning {{property 'q' not found on object of type 'rdar11363363 *'; did you mean to access property Q?}}
128 self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
129 self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
130 self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
131 self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
133 return self.R; // expected-error {{no getter method for read from property}} \
134 // expected-warning {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access property r?}}
138 @class BridgeFormatter;
140 @interface FMXBridgeFormatter
142 @property(assign, readwrite, getter=formatter, setter=setFormatter:) BridgeFormatter* cppFormatter;
146 @implementation FMXBridgeFormatter
147 @synthesize cppFormatter;