1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
3 @interface NSString @end
5 @interface NSObject @end
9 @property (retain) NSString* what;
12 @implementation SynthItAll
13 #if !__has_feature(objc_default_synthesize_properties)
14 @synthesize howMany, what;
19 @interface SynthSetter : NSObject
20 @property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair
21 @property (nonatomic, retain) NSString* what;
24 @implementation SynthSetter
25 #if !__has_feature(objc_default_synthesize_properties)
26 @synthesize howMany, what;
32 // - (void) setHowMany: (int) value
37 // - (void) setWhat: (NSString*) value
41 @interface SynthGetter : NSObject
42 @property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair
43 @property (nonatomic, retain) NSString* what;
46 @implementation SynthGetter
47 #if !__has_feature(objc_default_synthesize_properties)
48 @synthesize howMany, what;
52 - (void) setHowMany: (int) value {
57 - (void) setWhat: (NSString*) value {
58 if (self.what != value) {
64 @interface SynthNone : NSObject
65 @property int howMany;
66 @property (retain) NSString* what;
69 @implementation SynthNone
70 #if !__has_feature(objc_default_synthesize_properties)
71 @synthesize howMany, what; // REM: Redundant anyway
77 - (void) setHowMany: (int) value {
84 - (void) setWhat: (NSString*) value {
85 if (self.what != value) {
91 @property (readonly) id myString;
94 @interface TopClass <TopProtocol>
100 @interface SubClass : TopClass <TopProtocol>
103 @implementation SubClass @end
107 @interface C (Category)
108 @property int p; // expected-note 2 {{property declared here}}
110 @implementation C (Category) // expected-warning {{property 'p' requires method 'p' to be defined}} \
111 // expected-warning {{property 'p' requires method 'setP:' to be defined}}
114 // Don't complain if a property is already @synthesized by usr.
122 - (int) Meth { return self.PROP; }
123 #if __has_feature(objc_default_synthesize_properties)
124 @synthesize PROP=IVAR;
130 @property (nonatomic, strong) NSString *requiredString; // expected-note {{property declared here}}
133 @property (nonatomic, strong) NSString *optionalString;
136 @interface MyClass <MyProtocol>
139 @implementation MyClass // expected-warning {{auto property synthesis will not synthesize property declared in a protocol}}