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