Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | f034e9c | 2009-01-19 18:16:19 +0000 | [diff] [blame] | 2 | // Test that a property can be synthesize in a category |
| 3 | // implementation with no error. |
| 4 | |
| 5 | @protocol MyProtocol |
| 6 | @property float myFloat; |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 7 | @property float anotherFloat; // expected-note 2 {{property declared}} |
Fariborz Jahanian | f034e9c | 2009-01-19 18:16:19 +0000 | [diff] [blame] | 8 | @end |
| 9 | |
| 10 | @interface MyObject { float anotherFloat; } |
| 11 | @end |
| 12 | |
| 13 | @interface MyObject (CAT) <MyProtocol> |
| 14 | @end |
| 15 | |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 16 | @implementation MyObject (CAT) // expected-warning {{property 'anotherFloat' requires method}} \ |
| 17 | // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:'}} |
Fariborz Jahanian | f034e9c | 2009-01-19 18:16:19 +0000 | [diff] [blame] | 18 | @dynamic myFloat; // OK |
| 19 | @synthesize anotherFloat; // expected-error {{@synthesize not allowed in a category's implementation}} |
| 20 | @end |