| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | @interface B |
| 4 | +(int) classGetter; |
| 5 | -(int) getter; |
| 6 | @end |
| 7 | |
| 8 | @interface A : B |
| 9 | @end |
| 10 | |
| 11 | @implementation A |
| 12 | +(int) classGetter { |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | +(int) classGetter2 { |
| 17 | return super.classGetter; |
| 18 | } |
| 19 | |
| 20 | -(void) method { |
| 21 | int x = super.getter; |
| 22 | } |
| 23 | @end |
| 24 | |
| 25 | void f0() { |
| 26 | // FIXME: not implemented yet. |
| 27 | //int l1 = A.classGetter; |
| 28 | int l2 = [A classGetter2]; |
| 29 | } |
| 30 | |
| 31 | // rdar://13349296 |
| 32 | __attribute__((objc_root_class)) @interface ClassBase |
| 33 | @property (nonatomic, retain) ClassBase * foo; // expected-note {{property declared here}} |
| 34 | @end |
| 35 | |
| 36 | @implementation ClassBase |
| 37 | - (void) Meth:(ClassBase*)foo { |
| 38 | super.foo = foo; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}} |
| 39 | [super setFoo:foo]; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}} |
| 40 | } |
| 41 | @end |
| 42 | |
| 43 | @interface ClassDerived : ClassBase |
| 44 | @property (nonatomic, retain) ClassDerived * foo; // expected-warning {{auto property synthesis will not synthesize property 'foo'; it will be implemented by its superclass}} |
| 45 | @end |
| 46 | |
| 47 | @implementation ClassDerived // expected-note {{detected while default synthesizing properties in class implementation}} |
| 48 | - (void) Meth:(ClassBase*)foo { |
| 49 | super.foo = foo; // must work with no warning |
| 50 | [super setFoo:foo]; // works with no warning |
| 51 | } |
| 52 | @end |
| 53 | |
| 54 | @implementation IFaceNotFound (Foo) // expected-error {{cannot find interface declaration for 'IFaceNotFound'}} |
| 55 | -(int) foo { |
| 56 | return super.foo; // expected-error {{expected identifier or '('}} |
| 57 | } |
| 58 | @end |
| 59 | |