blob: 2b6564d2959399b187bf0221a9c45c85eafdc79e [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Steve Naroff4fa4ab62008-10-16 14:59:30 +00002
3typedef 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 Lattnerda3253d2008-10-20 06:33:53 +000039
40
41@interface BadPropClass
42{
Chris Lattner91867642008-10-20 07:03:51 +000043 int _awesome;
Chris Lattnerda3253d2008-10-20 06:33:53 +000044}
45
Douglas Gregorcb821d02010-04-08 21:33:23 +000046@property (readonly) int; // expected-warning {{declaration does not declare anything}}
Chris Lattnerda3253d2008-10-20 06:33:53 +000047@property (readonly) ; // expected-error {{type name requires a specifier or qualifier}} \
Douglas Gregorcb821d02010-04-08 21:33:23 +000048 expected-warning {{declaration does not declare anything}}
Chris Lattnerda3253d2008-10-20 06:33:53 +000049@property (readonly) int : 4; // expected-error {{property requires fields to be named}}
50
Chris Lattner91867642008-10-20 07:03:51 +000051
52// test parser recovery: rdar://6254579
Chris Lattner28eb7e92008-11-23 23:17:07 +000053@property ( // expected-note {{to match this '('}}
54 readonly getter=isAwesome) // expected-error {{error: expected ')'}}
55
Chris Lattner91867642008-10-20 07:03:51 +000056 int _awesome;
Chris Lattnercd9f4b32008-10-20 07:15:22 +000057@property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}}
58 int _awesome2;
59
Chris Lattner28eb7e92008-11-23 23:17:07 +000060@property ( // expected-note {{to match this '('}}
61 +) // expected-error {{error: expected ')'}}
62
Chris Lattnercd9f4b32008-10-20 07:15:22 +000063 int _awesome3;
Chris Lattner91867642008-10-20 07:03:51 +000064
Chris Lattnerda3253d2008-10-20 06:33:53 +000065@end
Chris Lattner91867642008-10-20 07:03:51 +000066
Steve Naroff18bc1642008-10-20 22:53:06 +000067@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 Jahanian02deae82010-01-06 00:18:12 +000087
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 Jahanian8b1aba42010-12-16 00:56:28 +000099// rdar://8774513
100@class MDAInstance; // expected-note {{forward class is declared here}}
101
102@interface MDATestDocument
103@property(retain) MDAInstance *instance;
104@end
105
106id f0(MDATestDocument *d) {
107 return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance *'}}
108}
109