diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-08 19:36:34 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-08 19:36:34 +0000 |
commit | 4c2743f0afe601b0e8ea7bd9b3cd0fb09083a181 (patch) | |
tree | 00a9fce22f9d7868bc562c6034548a48c50d1e64 /test/SemaObjC/property-typecheck-1.m | |
parent | eb71685510e0640b43e34ae9b567dcadb64075ee (diff) | |
download | clang-4c2743f0afe601b0e8ea7bd9b3cd0fb09083a181.tar.gz |
More type checking for properties, accessors and
use of dot-syntax expression. This is to match gcc's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71243 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC/property-typecheck-1.m')
-rw-r--r-- | test/SemaObjC/property-typecheck-1.m | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/test/SemaObjC/property-typecheck-1.m b/test/SemaObjC/property-typecheck-1.m index 1795da8599..c4d7cd2448 100644 --- a/test/SemaObjC/property-typecheck-1.m +++ b/test/SemaObjC/property-typecheck-1.m @@ -2,7 +2,7 @@ @interface A -(float) x; // expected-note {{declared at}} -@property int x; // expected-error {{type of property 'x' does not match type of accessor 'x'}} +@property int x; // expected-warning {{type of property 'x' does not match type of accessor 'x'}} @end @interface A (Cat) @@ -29,3 +29,73 @@ typedef void (F)(void); @end +@class SSyncSet; + +@interface SPeer + @property(nonatomic,readonly,retain) SSyncSet* syncSet; +@end + +@class SSyncSet_iDisk; + +@interface SPeer_iDisk_remote1 : SPeer +- (SSyncSet_iDisk*) syncSet; // expected-note {{declared at}} +@end + +@interface SPeer_iDisk_local +- (SSyncSet_iDisk*) syncSet; +@end + +@interface SSyncSet +@end + +@interface SSyncSet_iDisk +@property(nonatomic,readonly,retain) SPeer_iDisk_local* localPeer; +@end + +@interface SPeer_iDisk_remote1 (protected) +@end + +@implementation SPeer_iDisk_remote1 (protected) +- (id) preferredSource1 +{ + return self.syncSet.localPeer; // expected-warning {{type of property 'syncSet' does not match type of accessor 'syncSet'}} +} +@end + +@interface NSArray @end + +@interface NSMutableArray : NSArray +@end + +@interface Class1 +{ + NSMutableArray* pieces; + NSArray* first; +} + +@property (readonly) NSArray* pieces; +@property (readonly) NSMutableArray* first; // expected-warning {{type of property 'first' does not match type of accessor 'first'}} + +- (NSMutableArray*) pieces; +- (NSArray*) first; // expected-note {{declared at}} // expected-note {{declared at}} +@end + +@interface Class2 { + Class1* container; +} + +@end + +@implementation Class2 + +- (id) lastPiece +{ + return container.pieces; +} + +- (id)firstPeice +{ + return container.first; // expected-warning {{type of property 'first' does not match type of accessor 'first'}} +} +@end + |