John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 53395af | 2010-02-23 18:50:01 +0000 | [diff] [blame] | 2 | |
| 3 | /** |
| 4 | When processing @synthesize, treat ivars in a class extension the same as ivars in the class @interface, |
| 5 | and treat ivars in a superclass extension the same as ivars in the superclass @interface. |
| 6 | In particular, when searching for an ivar to back an @synthesize, do look at ivars in the class's own class |
| 7 | extension but ignore any ivars in superclass class extensions. |
| 8 | */ |
| 9 | |
| 10 | @interface Super { |
| 11 | int ISA; |
| 12 | } |
| 13 | @end |
| 14 | |
| 15 | @interface Super() { |
| 16 | int Property; // expected-note {{previously declared 'Property' here}} |
| 17 | } |
| 18 | @end |
| 19 | |
| 20 | @interface SomeClass : Super { |
| 21 | int interfaceIvar1; |
| 22 | int interfaceIvar2; |
| 23 | } |
| 24 | @property int Property; |
| 25 | @property int Property1; |
| 26 | @end |
| 27 | |
| 28 | @interface SomeClass () { |
| 29 | int Property1; |
| 30 | } |
| 31 | @end |
| 32 | |
| 33 | @implementation SomeClass |
| 34 | @synthesize Property; // expected-error {{property 'Property' attempting to use ivar 'Property' declared in super class 'Super'}} |
| 35 | @synthesize Property1; // OK |
| 36 | @end |