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