Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | |
| 3 | @interface I |
| 4 | { |
| 5 | int IVAR; |
Fariborz Jahanian | 6cdf16d | 2008-04-21 21:57:36 +0000 | [diff] [blame] | 6 | int name; |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 7 | } |
| 8 | @property int d1; |
Daniel Dunbar | 95e61fb | 2008-09-23 21:53:23 +0000 | [diff] [blame^] | 9 | @property id prop_id; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}, expected-warning {{default property attribute 'assign' not appropriate for non-gc object}} |
Fariborz Jahanian | 6cdf16d | 2008-04-21 21:57:36 +0000 | [diff] [blame] | 10 | @property int name; |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 11 | @end |
| 12 | |
| 13 | @interface I(CAT) |
| 14 | @property int d1; |
| 15 | @end |
| 16 | |
| 17 | @implementation I |
Fariborz Jahanian | 6cdf16d | 2008-04-21 21:57:36 +0000 | [diff] [blame] | 18 | @synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}} |
| 19 | @dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}} |
| 20 | @synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}} |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 21 | @synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}} |
Fariborz Jahanian | 6cdf16d | 2008-04-21 21:57:36 +0000 | [diff] [blame] | 22 | @synthesize name; // OK! property with same name as an accessible ivar of same name |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 23 | @end |
| 24 | |
Daniel Dunbar | 8a7267e | 2008-08-27 05:41:04 +0000 | [diff] [blame] | 25 | @implementation I(CAT) // expected-warning {{incomplete implementation}}, expected-warning {{method definition for 'd1' not found}}, // expected-warning {{method definition for 'setD1:' not found}} |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 26 | @synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}} |
| 27 | @dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}} |
| 28 | @end |
| 29 | |
| 30 | @implementation E // expected-warning {{cannot find interface declaration for 'E'}} |
Fariborz Jahanian | 6cdf16d | 2008-04-21 21:57:36 +0000 | [diff] [blame] | 31 | @dynamic d; // expected-error {{property implementation must have its declaration in interface 'E'}} |
Fariborz Jahanian | c35b9e4 | 2008-04-21 21:05:54 +0000 | [diff] [blame] | 32 | @end |
| 33 | |
| 34 | @implementation Q(MYCAT) // expected-error {{cannot find interface declaration for 'Q'}} |
| 35 | @dynamic d; // expected-error {{property implementation in a category with no category declaration}} |
| 36 | @end |
| 37 | |
| 38 | |
| 39 | |