summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-05-08 19:36:34 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-05-08 19:36:34 +0000
commitb2ab73d93cf5f73e5e49496c36e7bc58622c7f01 (patch)
treeb64b7916f98818a974063a5ce7d01f56b0106657 /clang/test
parent6e9959e327b3dffc670192de076e64c1927c83d3 (diff)
downloadbcm5719-llvm-b2ab73d93cf5f73e5e49496c36e7bc58622c7f01.tar.gz
bcm5719-llvm-b2ab73d93cf5f73e5e49496c36e7bc58622c7f01.zip
More type checking for properties, accessors and
use of dot-syntax expression. This is to match gcc's. llvm-svn: 71243
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/property-typecheck-1.m72
1 files changed, 71 insertions, 1 deletions
diff --git a/clang/test/SemaObjC/property-typecheck-1.m b/clang/test/SemaObjC/property-typecheck-1.m
index 1795da8599b..c4d7cd2448d 100644
--- a/clang/test/SemaObjC/property-typecheck-1.m
+++ b/clang/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
+
OpenPOWER on IntegriCloud