Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Steve Naroff | 4fa4ab6 | 2008-10-16 14:59:30 +0000 | [diff] [blame] | 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 |
Chris Lattner | da3253d | 2008-10-20 06:33:53 +0000 | [diff] [blame] | 39 | |
| 40 | |
| 41 | @interface BadPropClass |
| 42 | { |
Chris Lattner | 9186764 | 2008-10-20 07:03:51 +0000 | [diff] [blame] | 43 | int _awesome; |
Chris Lattner | da3253d | 2008-10-20 06:33:53 +0000 | [diff] [blame] | 44 | } |
| 45 | |
Douglas Gregor | cb821d0 | 2010-04-08 21:33:23 +0000 | [diff] [blame] | 46 | @property (readonly) int; // expected-warning {{declaration does not declare anything}} |
Chris Lattner | da3253d | 2008-10-20 06:33:53 +0000 | [diff] [blame] | 47 | @property (readonly) ; // expected-error {{type name requires a specifier or qualifier}} \ |
Douglas Gregor | cb821d0 | 2010-04-08 21:33:23 +0000 | [diff] [blame] | 48 | expected-warning {{declaration does not declare anything}} |
Chris Lattner | da3253d | 2008-10-20 06:33:53 +0000 | [diff] [blame] | 49 | @property (readonly) int : 4; // expected-error {{property requires fields to be named}} |
| 50 | |
Chris Lattner | 9186764 | 2008-10-20 07:03:51 +0000 | [diff] [blame] | 51 | |
| 52 | // test parser recovery: rdar://6254579 |
Chris Lattner | 28eb7e9 | 2008-11-23 23:17:07 +0000 | [diff] [blame] | 53 | @property ( // expected-note {{to match this '('}} |
| 54 | readonly getter=isAwesome) // expected-error {{error: expected ')'}} |
| 55 | |
Chris Lattner | 9186764 | 2008-10-20 07:03:51 +0000 | [diff] [blame] | 56 | int _awesome; |
Chris Lattner | cd9f4b3 | 2008-10-20 07:15:22 +0000 | [diff] [blame] | 57 | @property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}} |
| 58 | int _awesome2; |
| 59 | |
Chris Lattner | 28eb7e9 | 2008-11-23 23:17:07 +0000 | [diff] [blame] | 60 | @property ( // expected-note {{to match this '('}} |
| 61 | +) // expected-error {{error: expected ')'}} |
| 62 | |
Chris Lattner | cd9f4b3 | 2008-10-20 07:15:22 +0000 | [diff] [blame] | 63 | int _awesome3; |
Chris Lattner | 9186764 | 2008-10-20 07:03:51 +0000 | [diff] [blame] | 64 | |
Chris Lattner | da3253d | 2008-10-20 06:33:53 +0000 | [diff] [blame] | 65 | @end |
Chris Lattner | 9186764 | 2008-10-20 07:03:51 +0000 | [diff] [blame] | 66 | |
Steve Naroff | 18bc164 | 2008-10-20 22:53:06 +0000 | [diff] [blame] | 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 |
Fariborz Jahanian | 02deae8 | 2010-01-06 00:18:12 +0000 | [diff] [blame] | 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 | |
Fariborz Jahanian | 8b1aba4 | 2010-12-16 00:56:28 +0000 | [diff] [blame] | 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 | |