| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %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 |
@property (readonly) int : 4; // expected-error {{property requires fields to be named}} |
| 49 |
|
| 50 |
|
| 51 |
// test parser recovery |
| 52 |
@property ( // expected-note {{to match this '('}} |
| 53 |
readonly getter=isAwesome) // expected-error {{expected ')'}} |
| 54 |
|
| 55 |
int _awesome; |
| 56 |
@property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}} |
| 57 |
int _awesome2; |
| 58 |
|
| 59 |
@property ( // expected-note {{to match this '('}} |
| 60 |
+) // expected-error {{expected ')'}} |
| 61 |
|
| 62 |
int _awesome3; |
| 63 |
|
| 64 |
@end |
| 65 |
|
| 66 |
@protocol PVImageViewProtocol |
| 67 |
@property int inEyeDropperMode; |
| 68 |
@end |
| 69 |
|
| 70 |
@interface Cls |
| 71 |
@property int inEyeDropperMode; |
| 72 |
@end |
| 73 |
|
| 74 |
@interface PVAdjustColor @end |
| 75 |
|
| 76 |
@implementation PVAdjustColor |
| 77 |
|
| 78 |
- xx { |
| 79 |
id <PVImageViewProtocol> view; |
| 80 |
Cls *c; |
| 81 |
|
| 82 |
c.inEyeDropperMode = 1; |
| 83 |
view.inEyeDropperMode = 1; |
| 84 |
} |
| 85 |
@end |
| 86 |
|
| 87 |
@interface MyStyleIntf |
| 88 |
{ |
| 89 |
int _myStyle; |
| 90 |
} |
| 91 |
|
| 92 |
@property(readonly) int myStyle; |
| 93 |
|
| 94 |
- (float)setMyStyle:(int)style; |
| 95 |
@end |
| 96 |
|
| 97 |
@class MDAInstance; // expected-note {{forward declaration of class here}} |
| 98 |
|
| 99 |
@interface MDATestDocument |
| 100 |
@property(retain) MDAInstance *instance; |
| 101 |
@end |
| 102 |
|
| 103 |
id f0(MDATestDocument *d) { |
| 104 |
return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance'}} |
| 105 |
} |
| 106 |
|
| 107 |
@interface UIView @end |
| 108 |
|
| 109 |
@interface FRFakeBannerView : UIView |
| 110 |
@end |
| 111 |
|
| 112 |
@interface FRAdCollectionViewCell |
| 113 |
@property (nonatomic, weak, readonly) UIView *bannerView; |
| 114 |
@end |
| 115 |
|
| 116 |
@interface FRAdCollectionViewCell () |
| 117 |
|
| 118 |
@property (nonatomic, weak, readwrite) FRFakeBannerView *bannerView; |
| 119 |
|
| 120 |
@end |