1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 typedef signed char BOOL; 4 @protocol NSObject - (BOOL)isEqual:(id)object; @end 5 6 @interface NSObject <NSObject> {} @end 7 8 @interface _NSServicesInContextMenu : NSObject { 9 id _requestor; 10 NSObject *_appleEventDescriptor; 11 } 12 13 @property (retain, nonatomic) id requestor; 14 @property (retain, nonatomic) id appleEventDescriptor; 15 16 @end 17 18 @implementation _NSServicesInContextMenu 19 20 @synthesize requestor = _requestor, appleEventDescriptor = _appleEventDescriptor; 21 22 @end 23 24 @class NSString; 25 26 @protocol MyProtocol 27 - (NSString *)stringValue; 28 @end 29 30 @interface MyClass : NSObject { 31 id _myIvar; 32 } 33 @property (readwrite, retain) id<MyProtocol> myIvar; 34 @end 35 36 @implementation MyClass 37 @synthesize myIvar = _myIvar; 38 @end 39 40 41 @interface BadPropClass 42 { 43 int _awesome; 44 } 45 46 @property (readonly) int; // expected-warning {{declaration does not declare anything}} 47 @property (readonly) ; // expected-error {{type name requires a specifier or qualifier}} \ 48 expected-warning {{declaration does not declare anything}} 49 @property (readonly) int : 4; // expected-error {{property requires fields to be named}} 50 51 52 // test parser recovery: rdar://6254579 53 @property ( // expected-note {{to match this '('}} 54 readonly getter=isAwesome) // expected-error {{error: expected ')'}} 55 56 int _awesome; 57 @property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}} 58 int _awesome2; 59 60 @property ( // expected-note {{to match this '('}} 61 +) // expected-error {{error: expected ')'}} 62 63 int _awesome3; 64 65 @end 66 67 @protocol PVImageViewProtocol 68 @property int inEyeDropperMode; 69 @end 70 71 @interface Cls 72 @property int inEyeDropperMode; 73 @end 74 75 @interface PVAdjustColor @end 76 77 @implementation PVAdjustColor 78 79 - xx { 80 id <PVImageViewProtocol> view; 81 Cls *c; 82 83 c.inEyeDropperMode = 1; 84 view.inEyeDropperMode = 1; 85 } 86 @end 87 88 // radar 7427072 89 @interface MyStyleIntf 90 { 91 int _myStyle; 92 } 93 94 @property(readonly) int myStyle; 95 96 - (float)setMyStyle:(int)style; 97 @end 98 99 // rdar://8774513 100 @class MDAInstance; // expected-note {{forward class is declared here}} 101 102 @interface MDATestDocument 103 @property(retain) MDAInstance *instance; 104 @end 105 106 id f0(MDATestDocument *d) { 107 return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance *'}} 108 } 109 110