xref: /aosp_15_r20/external/clang/test/SemaObjC/protocol-implementation-inherited.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li// expected-no-diagnostics
3*67e74705SXin Li
4*67e74705SXin Li@protocol P0
5*67e74705SXin Li-bar;
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li@interface A <P0>
9*67e74705SXin Li@end
10*67e74705SXin Li
11*67e74705SXin Li// Interface conforms to inherited protocol
12*67e74705SXin Li
13*67e74705SXin Li@interface B0 : A <P0>
14*67e74705SXin Li@end
15*67e74705SXin Li
16*67e74705SXin Li@implementation B0
17*67e74705SXin Li@end
18*67e74705SXin Li
19*67e74705SXin Li// Interface conforms to a protocol which extends another. The other
20*67e74705SXin Li// protocol is inherited, and extended methods are implemented.
21*67e74705SXin Li
22*67e74705SXin Li@protocol P1 <P0>
23*67e74705SXin Li-foo;
24*67e74705SXin Li@end
25*67e74705SXin Li
26*67e74705SXin Li@interface B1 : A <P1>
27*67e74705SXin Li@end
28*67e74705SXin Li
29*67e74705SXin Li@implementation B1
30*67e74705SXin Li-foo { return 0; };
31*67e74705SXin Li@end
32*67e74705SXin Li
33*67e74705SXin Li// Interface conforms to a protocol whose methods are provided by an
34*67e74705SXin Li// alternate inherited protocol.
35*67e74705SXin Li
36*67e74705SXin Li@protocol P2
37*67e74705SXin Li-bar;
38*67e74705SXin Li@end
39*67e74705SXin Li
40*67e74705SXin Li@interface B2 : A <P2>
41*67e74705SXin Li@end
42*67e74705SXin Li
43*67e74705SXin Li@implementation B2
44*67e74705SXin Li@end
45*67e74705SXin Li
46*67e74705SXin Li// Interface conforms to a protocol whose methods are provided by a base class.
47*67e74705SXin Li
48*67e74705SXin Li@interface A1
49*67e74705SXin Li-bar;
50*67e74705SXin Li@end
51*67e74705SXin Li
52*67e74705SXin Li@interface B3 : A1 <P2>
53*67e74705SXin Li@end
54*67e74705SXin Li
55*67e74705SXin Li@implementation B3
56*67e74705SXin Li@end
57*67e74705SXin Li
58