Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | b1006c7 | 2009-03-04 17:50:39 +0000 | [diff] [blame] | 2 | |
| 3 | @interface MyBase |
| 4 | - (void) rootInstanceMethod; |
| 5 | @end |
| 6 | |
| 7 | @interface MyIntermediate: MyBase |
| 8 | @end |
| 9 | |
| 10 | @interface MyDerived: MyIntermediate |
| 11 | - (void) instanceMethod; |
| 12 | + (void) classMethod; |
| 13 | @end |
| 14 | |
| 15 | @implementation MyDerived |
| 16 | - (void) instanceMethod { |
| 17 | } |
| 18 | |
| 19 | + (void) classMethod { /* If a class method is not found, the root */ |
| 20 | [self rootInstanceMethod]; /* class is searched for an instance method */ |
| 21 | [MyIntermediate rootInstanceMethod]; /* with the same name. */ |
| 22 | |
Fariborz Jahanian | 2600503 | 2010-12-01 01:07:24 +0000 | [diff] [blame] | 23 | [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}} |
Fariborz Jahanian | b1006c7 | 2009-03-04 17:50:39 +0000 | [diff] [blame] | 24 | [MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}} |
| 25 | } |
| 26 | @end |
| 27 | |
| 28 | @interface Object @end |
| 29 | |
| 30 | @interface Class1 |
| 31 | - (void)setWindow:(Object *)wdw; |
| 32 | @end |
| 33 | |
| 34 | @interface Class2 |
| 35 | - (void)setWindow:(Class1 *)window; |
| 36 | @end |
| 37 | |
| 38 | #define nil (void*)0 |
| 39 | |
| 40 | id foo(void) { |
| 41 | Object *obj; |
| 42 | id obj2 = obj; |
Chris Lattner | 0784fcd | 2010-04-11 07:04:01 +0000 | [diff] [blame] | 43 | [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}} |
Fariborz Jahanian | b1006c7 | 2009-03-04 17:50:39 +0000 | [diff] [blame] | 44 | |
| 45 | return obj; |
| 46 | } |