xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/property-ambiguous-synthesis.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc// rdar://13075400
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc@protocol FooAsID
5*f4a2713aSLionel Sambuc@property (copy) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\
6*f4a2713aSLionel Sambuc			 // expected-warning {{property of type 'id' was selected for synthesis}}
7*f4a2713aSLionel Sambuc@end
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc@protocol FooAsDouble
10*f4a2713aSLionel Sambuc@property double foo; // expected-warning 2 {{property of type 'double' was selected for synthesis}} \
11*f4a2713aSLionel Sambuc		      // expected-note {{it could also be property of type 'double' declared here}}
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc@protocol FooAsShort
15*f4a2713aSLionel Sambuc@property short foo; // expected-note {{it could also be property of type 'short' declared here}}
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@interface NSObject @end
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc@interface AnObject : NSObject<FooAsDouble,FooAsID>
21*f4a2713aSLionel Sambuc@end
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc@interface Sub : AnObject
24*f4a2713aSLionel Sambuc@end
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc@implementation Sub
27*f4a2713aSLionel Sambuc@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
28*f4a2713aSLionel Sambuc@end
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambuc@interface AnotherObject : NSObject<FooAsDouble, FooAsID,FooAsDouble, FooAsID, FooAsDouble,FooAsID>
32*f4a2713aSLionel Sambuc@end
33*f4a2713aSLionel Sambuc
34*f4a2713aSLionel Sambuc@implementation AnotherObject
35*f4a2713aSLionel Sambuc@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
36*f4a2713aSLionel Sambuc@end
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc@interface YetAnotherObject : NSObject<FooAsID,FooAsShort, FooAsDouble,FooAsID, FooAsShort>
40*f4a2713aSLionel Sambuc@end
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc@implementation YetAnotherObject
43*f4a2713aSLionel Sambuc@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
44*f4a2713aSLionel Sambuc@end
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel Sambucdouble func(YetAnotherObject *object) {
47*f4a2713aSLionel Sambuc  return [object foo]; // expected-error {{returning 'id' from a function with incompatible result type 'double'}}
48*f4a2713aSLionel Sambuc}
49