blob: d691f124e8a51005b14fc065a24b83023b1a4bb4 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanianb16308f2008-11-26 20:33:54 +00002
3@interface ReadOnly
4{
5 id _object;
6 id _object1;
7}
Fariborz Jahaniancc667e22009-11-03 00:01:38 +00008@property(readonly) id object; // expected-note {{property declared here}}
Fariborz Jahaniana6f14e12009-11-02 22:45:15 +00009@property(readwrite, assign) id object1; // expected-note {{property declared here}}
Fariborz Jahaniand669be52009-11-06 22:59:12 +000010@property (readonly) int indentLevel;
Fariborz Jahanianb16308f2008-11-26 20:33:54 +000011@end
12
13@interface ReadOnly ()
Fariborz Jahaniancc667e22009-11-03 00:01:38 +000014@property(readwrite, copy) id object; // expected-warning {{property attribute in continuation class does not match the primary class}}
Ted Kremenek788f4892010-10-21 18:49:42 +000015@property(readonly) id object1; // expected-error {{illegal redeclaration of property in continuation class 'ReadOnly' (attribute must be 'readwrite', while its primary must be 'readonly')}}
Fariborz Jahaniand669be52009-11-06 22:59:12 +000016@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
Fariborz Jahanianb16308f2008-11-26 20:33:54 +000017@end
Fariborz Jahaniana6f14e12009-11-02 22:45:15 +000018
19@protocol Proto
20 @property (copy) id fee; // expected-note {{property declared here}}
21@end
22
23@protocol Foo<Proto>
24 @property (copy) id foo; // expected-note {{property declared here}}
25@end
26
27@interface Bar <Foo> {
28 id _foo;
29 id _fee;
30}
31@end
32
33@interface Bar ()
Ted Kremenek788f4892010-10-21 18:49:42 +000034@property (copy) id foo; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
35@property (copy) id fee; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
Fariborz Jahaniana6f14e12009-11-02 22:45:15 +000036@end
37
38@implementation Bar
39@synthesize foo = _foo;
40@synthesize fee = _fee;
41@end
42
Fariborz Jahanianc645ddf2012-02-02 00:49:12 +000043// rdar://10752081
44@interface MyOtherClass() // expected-error {{cannot find interface declaration for 'MyOtherClass'}}
45{
46 id array;
47}
48@end
49
50@implementation MyOtherClass // expected-warning {{cannot find interface declaration for 'MyOtherClass'}}
51@end