xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/super-class-protocol-conformance.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -disable-objc-default-synthesize-properties %s
2*f4a2713aSLionel Sambuc// rdar://7884086
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc@interface NSObject @end
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@protocol TopProtocol
7*f4a2713aSLionel Sambuc  @property (readonly) id myString; // expected-note {{property}}
8*f4a2713aSLionel Sambuc@end
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@protocol SubProtocol <TopProtocol>
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@interface TopClass : NSObject <TopProtocol> {}
14*f4a2713aSLionel Sambuc@end
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc@interface SubClass : TopClass <SubProtocol> {}
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@interface SubClass1 : TopClass {}
20*f4a2713aSLionel Sambuc@end
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc@implementation SubClass1 @end // Test1 - No Warning
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@implementation TopClass  // expected-warning {{property 'myString' requires method 'myString' to be defined}}
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@implementation SubClass // Test3 - No Warning
28*f4a2713aSLionel Sambuc@end
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc@interface SubClass2  : TopClass<TopProtocol>
31*f4a2713aSLionel Sambuc@end
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc@implementation SubClass2 @end // Test 4 - No Warning
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc@interface SubClass3 : TopClass<SubProtocol> @end
36*f4a2713aSLionel Sambuc@implementation SubClass3 @end	// Test 5 - No Warning
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambuc@interface SubClass4 : SubClass3 @end
39*f4a2713aSLionel Sambuc@implementation SubClass4 @end	// Test 5 - No Warning
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambuc@protocol NewProtocol
42*f4a2713aSLionel Sambuc  @property (readonly) id myNewString;  // expected-note {{property}}
43*f4a2713aSLionel Sambuc@end
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc@interface SubClass5 : SubClass4 <NewProtocol> @end
46*f4a2713aSLionel Sambuc@implementation SubClass5 @end   // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}}
47*f4a2713aSLionel Sambuc
48*f4a2713aSLionel Sambuc
49*f4a2713aSLionel Sambuc// Radar 8035776
50*f4a2713aSLionel Sambuc@protocol SuperProtocol
51*f4a2713aSLionel Sambuc@end
52*f4a2713aSLionel Sambuc
53*f4a2713aSLionel Sambuc@interface Super <SuperProtocol>
54*f4a2713aSLionel Sambuc@end
55*f4a2713aSLionel Sambuc
56*f4a2713aSLionel Sambuc@protocol ProtocolWithProperty <SuperProtocol>
57*f4a2713aSLionel Sambuc@property (readonly, assign) id invalidationBacktrace; // expected-note {{property}}
58*f4a2713aSLionel Sambuc@end
59*f4a2713aSLionel Sambuc
60*f4a2713aSLionel Sambuc@interface INTF : Super <ProtocolWithProperty>
61*f4a2713aSLionel Sambuc@end
62*f4a2713aSLionel Sambuc
63*f4a2713aSLionel Sambuc@implementation INTF @end // expected-warning{{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}}
64