xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/property-in-class-extension.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc// rdar://7766184
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc@interface Foo @end
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface Foo ()
7*f4a2713aSLionel Sambuc  @property (readonly) int bar;
8*f4a2713aSLionel Sambuc@end
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambucvoid FUNC () {
11*f4a2713aSLionel Sambuc    Foo *foo;
12*f4a2713aSLionel Sambuc    foo.bar = 0; // expected-error {{assignment to readonly property}}
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc// rdar://8747333
16*f4a2713aSLionel Sambuc@class NSObject;
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@interface rdar8747333  {
19*f4a2713aSLionel Sambuc@private
20*f4a2713aSLionel Sambuc    NSObject *_bar;
21*f4a2713aSLionel Sambuc    NSObject *_baz;
22*f4a2713aSLionel Sambuc    NSObject *_bam;
23*f4a2713aSLionel Sambuc}
24*f4a2713aSLionel Sambuc- (NSObject *)baz;
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@interface rdar8747333 ()
28*f4a2713aSLionel Sambuc- (NSObject *)bar;
29*f4a2713aSLionel Sambuc@end
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambuc@interface rdar8747333 ()
32*f4a2713aSLionel Sambuc@property (readwrite, assign) NSObject *bar;
33*f4a2713aSLionel Sambuc@property (readwrite, assign) NSObject *baz;
34*f4a2713aSLionel Sambuc@property (readwrite, assign) NSObject *bam;
35*f4a2713aSLionel Sambuc@property (readwrite, assign) NSObject *warn;
36*f4a2713aSLionel Sambuc@end
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambuc@interface rdar8747333 ()
39*f4a2713aSLionel Sambuc- (NSObject *)bam;
40*f4a2713aSLionel Sambuc- (NSObject *)warn;	// expected-note {{method 'warn' declared here}}
41*f4a2713aSLionel Sambuc- (void)setWarn : (NSObject *)val; // expected-note {{method 'setWarn:' declared here}}
42*f4a2713aSLionel Sambuc@end
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc@implementation rdar8747333 // expected-warning {{method definition for 'warn' not found}} \
45*f4a2713aSLionel Sambuc                            // expected-warning {{method definition for 'setWarn:' not found}}
46*f4a2713aSLionel Sambuc@synthesize bar = _bar;
47*f4a2713aSLionel Sambuc@synthesize baz = _baz;
48*f4a2713aSLionel Sambuc@synthesize bam = _bam;
49*f4a2713aSLionel Sambuc@dynamic warn;
50*f4a2713aSLionel Sambuc@end
51*f4a2713aSLionel Sambuc
52