Douglas Gregor | a12d294 | 2010-02-16 01:20:57 +0000 | [diff] [blame] | 1 | // Matches |
Douglas Gregor | 2e55e3a | 2010-02-17 00:34:30 +0000 | [diff] [blame] | 2 | @interface I1 { |
| 3 | int ivar1; |
| 4 | } |
Douglas Gregor | a12d294 | 2010-02-16 01:20:57 +0000 | [diff] [blame] | 5 | @end |
| 6 | |
| 7 | // Matches |
Douglas Gregor | 2e55e3a | 2010-02-17 00:34:30 +0000 | [diff] [blame] | 8 | @interface I2 : I1 { |
| 9 | float ivar2; |
| 10 | } |
| 11 | @end |
| 12 | |
| 13 | // Ivar mismatch |
| 14 | @interface I3 { |
| 15 | int ivar1; |
| 16 | float ivar2; |
| 17 | } |
| 18 | @end |
| 19 | |
| 20 | // Superclass mismatch |
| 21 | @interface I4 : I1 { |
| 22 | } |
Douglas Gregor | a12d294 | 2010-02-16 01:20:57 +0000 | [diff] [blame] | 23 | @end |
Douglas Gregor | c3f2d2b | 2010-02-17 02:12:47 +0000 | [diff] [blame] | 24 | |
| 25 | // Methods match |
| 26 | @interface I5 |
| 27 | + (float)bar; |
| 28 | - (int)foo; |
| 29 | @end |
| 30 | |
| 31 | // Method mismatch |
| 32 | @interface I6 |
| 33 | + (float)foo; |
| 34 | @end |
| 35 | |
| 36 | // Method mismatch |
| 37 | @interface I7 |
| 38 | - (int)foo; |
| 39 | + (int)bar:(float)x; |
| 40 | @end |
| 41 | |
| 42 | // Method mismatch |
| 43 | @interface I8 |
| 44 | - (int)foo; |
| 45 | + (int)bar:(float)x, ...; |
| 46 | @end |
Douglas Gregor | 2e2a400 | 2010-02-17 16:12:00 +0000 | [diff] [blame] | 47 | |
| 48 | // Matching protocol |
| 49 | @protocol P0 |
| 50 | + (int)foo; |
| 51 | - (int)bar:(float)x; |
| 52 | @end |
| 53 | |
| 54 | // Protocol with mismatching method |
| 55 | @protocol P1 |
| 56 | + (int)foo; |
| 57 | - (int)bar:(double)x; |
| 58 | @end |
| 59 | |
| 60 | // Interface with protocol |
| 61 | @interface I9 <P0> |
| 62 | + (int)foo; |
| 63 | - (int)bar:(float)x; |
| 64 | @end |
| 65 | |
| 66 | // Protocol with protocol |
| 67 | @protocol P2 <P0> |
| 68 | - (float)wibble:(int)a1 second:(int)a2; |
| 69 | @end |
Douglas Gregor | a2bc15b | 2010-02-18 02:04:09 +0000 | [diff] [blame^] | 70 | |
| 71 | // Forward-declared interface |
| 72 | @class I12, I10; |
| 73 | @interface I11 |
| 74 | @end |