107 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface A4-(float) x; // expected-note {{declared here}}5@property int x; // expected-warning {{type of property 'x' does not match type of accessor 'x'}}6@end7 8@interface A (Cat)9@property int moo; // expected-note {{previous definition is here}}10@end11 12@implementation A (Cat)13-(int) moo {14 return 0;15}16-(void) setMoo: (float) x { // expected-warning {{conflicting parameter types in implementation of 'setMoo:': 'int' vs 'float'}}17}18@end19 20 21typedef int T[2];22typedef void (F)(void);23 24@interface C25@property(assign) T p2; // expected-error {{property cannot have array or function type 'T'}}26 27@property(assign) F f2; // expected-error {{property cannot have array or function type 'F'}}28 29@end30 31 32@class SSyncSet;33 34@interface SPeer35 @property(nonatomic,readonly,retain) SSyncSet* syncSet;36@end37 38@class SSyncSet_iDisk;39 40@interface SPeer_iDisk_remote1 : SPeer41- (SSyncSet_iDisk*) syncSet; // expected-note {{declared here}}42@end43 44@interface SPeer_iDisk_local45- (SSyncSet_iDisk*) syncSet;46@end47 48@interface SSyncSet49@end50 51@interface SSyncSet_iDisk52@property(nonatomic,readonly,retain) SPeer_iDisk_local* localPeer;53@end54 55@interface SPeer_iDisk_remote1 (protected)56@end57 58@implementation SPeer_iDisk_remote1 (protected)59- (id) preferredSource160{61 return self.syncSet.localPeer; // expected-warning {{type of property 'syncSet' does not match type of accessor 'syncSet'}}62}63@end64 65@interface NSArray @end66 67@interface NSMutableArray : NSArray68@end69 70@interface Class1 71{72 NSMutableArray* pieces;73 NSArray* first;74}75 76@property (readonly) NSArray* pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}77@property (readonly) NSMutableArray* first;78 79- (NSMutableArray*) pieces; // expected-note 2 {{declared here}}80- (NSArray*) first;81 82// Don't warn about setter-like methods for readonly properties.83- (void)setFirst:(char)val;84- (void)setPieces:(char)val;85 86@end87 88@interface Class2 {89 Class1* container;90}91 92@end93 94@implementation Class295 96- (id) lastPiece97{98 return container.pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}99}100 101- (id)firstPiece102{103 return container.first;104}105@end106 107