1 // RUN: %clang_cc1 -fsyntax-only -Wobjc-missing-property-synthesis -verify -Wno-objc-root-class -triple=x86_64-apple-macos10.10 %s
9 @interface SynthItAll : NSObject
10 @property int howMany; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
11 @property (retain) NSString* what; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
14 @implementation SynthItAll // expected-note 2 {{detected while default synthesizing properties in class implementation}}
15 //@synthesize howMany, what;
19 @interface SynthSetter : NSObject
20 @property (nonatomic) int howMany; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
21 @property (nonatomic, retain) NSString* what; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
24 @implementation SynthSetter // expected-note 2 {{detected while default synthesizing properties in class implementation}}
25 //@synthesize howMany, what;
30 // - (void) setHowMany: (int) value
35 // - (void) setWhat: (NSString*) value
39 @interface SynthGetter : NSObject
40 @property (nonatomic) int howMany; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
41 @property (nonatomic, retain) NSString* what; // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
44 @implementation SynthGetter // expected-note 2 {{detected while default synthesizing properties in class implementation}}
45 //@synthesize howMany, what;
48 - (void) setHowMany: (int) value {
53 - (void) setWhat: (NSString*) value {
56 _what = [value retain];
62 @interface SynthNone : NSObject
63 @property int howMany;
64 @property (retain) NSString* what;
67 @implementation SynthNone
68 //@synthesize howMany, what; // REM: Redundant anyway
71 return howMany; // expected-error {{use of undeclared identifier 'howMany'}}
73 - (void) setHowMany: (int) value {
74 howMany = value; // expected-error {{use of undeclared identifier 'howMany'}}
78 return what; // expected-error {{use of undeclared identifier 'what'}}
80 - (void) setWhat: (NSString*) value {
81 if (what != value) { // expected-error {{use of undeclared identifier 'what'}}
82 [what release]; // expected-error {{use of undeclared identifier 'what'}}
83 what = [value retain]; // expected-error {{use of undeclared identifier 'what'}}
88 // No default synthesis if implementation has getter (readonly) and setter(readwrite) methods.
89 @interface DSATextSearchResult
90 @property(assign,readonly) float relevance;
91 @property(assign,readonly) char isTitleMatch;
94 @interface DSANodeSearchResult : DSATextSearchResult {}
98 @implementation DSATextSearchResult
108 @implementation DSANodeSearchResult
109 -(id)initWithNode:(id )node relevance:(float)relevance isTitleMatch:(char)isTitleMatch {
116 @interface rdar11333367
117 @property enum A x; // expected-note {{forward declaration of 'enum A'}} expected-note {{property declared here}}
118 @property struct B y; // expected-note {{forward declaration of 'struct B'}} expected-note {{property declared here}} \
119 // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
121 @implementation rdar11333367 // expected-error {{cannot synthesize property 'y' with incomplete type 'struct B'}} \
122 // expected-note {{detected while default synthesizing properties in class implementation}}
123 @synthesize x; // expected-error {{cannot synthesize property 'x' with incomplete type 'enum A'}}
126 @interface ZXParsedResult
127 @property (nonatomic, copy, readonly) NSString *description; // expected-note {{property declared here}}
130 @interface ZXCalendarParsedResult : ZXParsedResult
132 @property (nonatomic, copy, readonly) NSString *description; // expected-warning {{auto property synthesis will not synthesize property 'description'; it will be implemented by its superclass}}
136 @implementation ZXCalendarParsedResult // expected-note {{detected while default synthesizing properties in class implementation}}
137 - (NSString *) Meth {
138 return _description; // expected-error {{use of undeclared identifier '_description'}}
142 @interface DontWarnOnUnavailable
144 // No warning expected:
145 @property (nonatomic, readonly) int un1 __attribute__((unavailable));
146 @property (readwrite) int un2 __attribute__((availability(macos, unavailable)));
148 @property (readwrite) int un3 __attribute__((availability(ios, unavailable))); // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
152 @implementation DontWarnOnUnavailable // expected-note {{detected while default synthesizing properties in class implementation}}