blob: 6c06b90a9f0a7dec332f5ab52df7b5ebb1a6d9b1 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc %s -fsyntax-only -verify
Steve Naroff15edf0d2009-03-03 15:43:24 +00002
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