51 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface ReadOnly 4{5 id _object;6 id _object1;7}8@property(readonly) id object;9@property(readwrite, assign) id object1; // expected-note {{property declared here}}10@property (readonly) int indentLevel;11@end12 13@interface ReadOnly ()14@property(readwrite, copy) id object; // Ok. declaring memory model in class extension - primary has none.15@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@property (readwrite, assign) int indentLevel; // OK. assign the default in any case.17@end18 19@protocol Proto20 @property (copy) id fee; // expected-note {{property declared here}}21@end22 23@protocol Foo<Proto>24 @property (copy) id foo; // expected-note {{property declared here}}25@end26 27@interface Bar <Foo> {28 id _foo;29 id _fee;30}31@end32 33@interface Bar ()34@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@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@end37 38@implementation Bar39@synthesize foo = _foo;40@synthesize fee = _fee;41@end42 43@interface MyOtherClass() // expected-error {{cannot find interface declaration for 'MyOtherClass'}}44{45 id array;46}47@end48 49@implementation MyOtherClass // expected-warning {{cannot find interface declaration for 'MyOtherClass'}}50@end51