diff options
Diffstat (limited to 'test/SemaObjC/default-synthesize-3.m')
-rw-r--r-- | test/SemaObjC/default-synthesize-3.m | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/SemaObjC/default-synthesize-3.m b/test/SemaObjC/default-synthesize-3.m index 606ece3..82f968d 100644 --- a/test/SemaObjC/default-synthesize-3.m +++ b/test/SemaObjC/default-synthesize-3.m @@ -39,3 +39,75 @@ __attribute ((objc_requires_property_definitions)) __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requires_property_definitions attribute may only be specified on a class}} @protocol P @end + +// rdar://13388503 +@interface NSObject @end +@protocol Foo +@property (readonly) char isFoo; // expected-note {{property declared here}} +@property (readonly) char isNotFree; +@end + +@interface Bar : NSObject <Foo> +@end + +@implementation Bar +- (char)isFoo { + return 0; +} +- (char)isNotFree { + return 0; +} +@end + +@interface Baz : Bar +@end + +@interface Baz () +@property (readwrite) char isFoo; // expected-warning {{auto property synthesis will not synthesize property 'isFoo' because it is 'readwrite' but it will be synthesized 'readonly' via another property}} +@property char Property1; // expected-warning {{auto property synthesis will not synthesize property 'Property1' because it cannot share an ivar with another synthesized property}} +@property char Property2; +@property (readwrite) char isNotFree; +@end + +@implementation Baz { + char _isFoo; + char _isNotFree; +} +@synthesize Property2 = Property1; // expected-note {{property synthesized here}} + +- (void) setIsNotFree : (char)Arg { + _isNotFree = Arg; +} + +@end + +// More test where such warnings should not be issued. +@protocol MyProtocol +-(void)setProp1:(id)x; +@end + +@protocol P1 <MyProtocol> +@end + +@interface B +@property (readonly) id prop; +@property (readonly) id prop1; +@property (readonly) id prop2; +@end + +@interface B() +-(void)setProp:(id)x; +@end + +@interface B(cat) +@property (readwrite) id prop2; +@end + +@interface S : B<P1> +@property (assign,readwrite) id prop; +@property (assign,readwrite) id prop1; +@property (assign,readwrite) id prop2; +@end + +@implementation S +@end |