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