blob: 7669e44dab846dfcd0d97dcf8a4cfa135a941baf [file] [log] [blame]
Steve Naroff15edf0d2009-03-03 15:43:24 +00001// RUN: clang %s -fsyntax-only -verify
2
3// <rdar://problem/6497242> Inherited overridden protocol declared objects don't work
4
5@protocol NSObject @end
6@interface NSObject @end
7
8@protocol FooDelegate<NSObject>
9@optional
10- (void)fooTask;
11@end
12
13@protocol BarDelegate<NSObject, FooDelegate>
14@optional
15- (void)barTask;
16@end
17
18@interface Foo : NSObject {
19 id _delegate;
20}
21@property(nonatomic, assign) id<FooDelegate> delegate;
22@property(nonatomic, assign) id<BarDelegate> delegate2;
23@end
24@interface Bar : Foo {
25}
26@property(nonatomic, assign) id<BarDelegate> delegate;
27@property(nonatomic, assign) id<FooDelegate> delegate2; // expected-warning{{property type 'id<FooDelegate>' is incompatible with type 'id<BarDelegate>' inherited from 'Foo'}}
28@end
29
30@interface NSData @end
31
32@interface NSMutableData : NSData @end
33
34@interface Base : NSData
35@property(assign) id ref;
36@property(assign) Base *p_base;
37@property(assign) NSMutableData *p_data;
38@end
39
40@interface Data : Base
41@property(assign) NSData *ref;
42@property(assign) Data *p_base;
43@property(assign) NSData *p_data; // expected-warning{{property type 'NSData *' is incompatible with type 'NSMutableData *' inherited from 'Base'}}
44@end