xref: /aosp_15_r20/external/clang/test/SemaObjC/continuation-class-err.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@interface ReadOnly
4*67e74705SXin Li{
5*67e74705SXin Li  id _object;
6*67e74705SXin Li  id _object1;
7*67e74705SXin Li}
8*67e74705SXin Li@property(readonly) id object;
9*67e74705SXin Li@property(readwrite, assign) id object1; // expected-note {{property declared here}}
10*67e74705SXin Li@property (readonly) int indentLevel;
11*67e74705SXin Li@end
12*67e74705SXin Li
13*67e74705SXin Li@interface ReadOnly ()
14*67e74705SXin Li@property(readwrite, copy) id object; // Ok. declaring memory model in class extension - primary has none.
15*67e74705SXin Li@property(readonly) id object1; // expected-error {{illegal redeclaration of property in class extension 'ReadOnly' (attribute must be 'readwrite', while its primary must be 'readonly')}}
16*67e74705SXin Li@property (readwrite, assign) int indentLevel; // OK. assign the default in any case.
17*67e74705SXin Li@end
18*67e74705SXin Li
19*67e74705SXin Li@protocol Proto
20*67e74705SXin Li  @property (copy) id fee; // expected-note {{property declared here}}
21*67e74705SXin Li@end
22*67e74705SXin Li
23*67e74705SXin Li@protocol Foo<Proto>
24*67e74705SXin Li  @property (copy) id foo; // expected-note {{property declared here}}
25*67e74705SXin Li@end
26*67e74705SXin Li
27*67e74705SXin Li@interface Bar  <Foo> {
28*67e74705SXin Li        id _foo;
29*67e74705SXin Li        id _fee;
30*67e74705SXin Li}
31*67e74705SXin Li@end
32*67e74705SXin Li
33*67e74705SXin Li@interface Bar ()
34*67e74705SXin Li@property (copy) id foo; // expected-error {{illegal redeclaration of property in class extension 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
35*67e74705SXin Li@property (copy) id fee; // expected-error {{illegal redeclaration of property in class extension 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
36*67e74705SXin Li@end
37*67e74705SXin Li
38*67e74705SXin Li@implementation Bar
39*67e74705SXin Li@synthesize foo = _foo;
40*67e74705SXin Li@synthesize fee = _fee;
41*67e74705SXin Li@end
42*67e74705SXin Li
43*67e74705SXin Li// rdar://10752081
44*67e74705SXin Li@interface MyOtherClass() // expected-error {{cannot find interface declaration for 'MyOtherClass'}}
45*67e74705SXin Li{
46*67e74705SXin Li id array;
47*67e74705SXin Li}
48*67e74705SXin Li@end
49*67e74705SXin Li
50*67e74705SXin Li@implementation MyOtherClass // expected-warning {{cannot find interface declaration for 'MyOtherClass'}}
51*67e74705SXin Li@end
52