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