Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 1 | // Matches |
| 2 | @interface I1 { |
| 3 | int ivar1; |
| 4 | } |
| 5 | @end |
| 6 | |
| 7 | // Matches |
| 8 | @interface I2 : I1 { |
| 9 | float ivar2; |
| 10 | } |
| 11 | @end |
| 12 | |
| 13 | // Ivar mismatch |
| 14 | @interface I3 { |
| 15 | int ivar1; |
| 16 | int ivar2; |
| 17 | } |
| 18 | @end |
| 19 | |
| 20 | // Superclass mismatch |
| 21 | @interface I4 : I2 { |
| 22 | } |
| 23 | @end |
| 24 | |
| 25 | // Methods match |
| 26 | @interface I5 |
| 27 | - (int)foo; |
| 28 | + (float)bar; |
| 29 | @end |
| 30 | |
| 31 | // Method mismatch |
| 32 | @interface I6 |
| 33 | - (int)foo; |
| 34 | + (int)foo; |
| 35 | @end |
| 36 | |
| 37 | // Method mismatch |
| 38 | @interface I7 |
| 39 | - (int)foo; |
| 40 | + (int)bar:(int)x; |
| 41 | @end |
| 42 | |
| 43 | // Method mismatch |
| 44 | @interface I8 |
| 45 | - (int)foo; |
| 46 | + (int)bar:(float)x; |
| 47 | @end |
| 48 | |
| 49 | // Matching protocol |
| 50 | @protocol P0 |
| 51 | + (int)foo; |
| 52 | - (int)bar:(float)x; |
| 53 | @end |
| 54 | |
| 55 | // Protocol with mismatching method |
| 56 | @protocol P1 |
| 57 | + (int)foo; |
| 58 | - (int)bar:(float)x; |
| 59 | @end |
| 60 | |
| 61 | // Interface with protocol |
| 62 | @interface I9 <P0> |
| 63 | + (int)foo; |
| 64 | - (int)bar:(float)x; |
| 65 | @end |
| 66 | |
| 67 | // Protocol with protocol |
| 68 | @protocol P2 <P0> |
| 69 | - (float)wibble:(int)a1 second:(int)a2; |
| 70 | @end |
| 71 | |
| 72 | // Forward-declared interfaces |
| 73 | @class I10, I11; |
| 74 | @interface I12 |
| 75 | @end |
| 76 | |
| 77 | // Forward-declared protocols |
| 78 | @protocol P3, P5; |
| 79 | @protocol P4 |
| 80 | - (double)honk:(int)a; |
| 81 | @end |
| 82 | |
| 83 | // Interface with implementation |
| 84 | @interface I13 |
| 85 | @end |
| 86 | |
| 87 | @implementation I13 |
| 88 | @end |
| 89 | |
| 90 | @interface I13a |
| 91 | @end |
| 92 | |
| 93 | @implementation I13a |
| 94 | @end |
| 95 | |
| 96 | // Implementation by itself |
| 97 | @implementation I14 : I12 |
| 98 | @end |
| 99 | |
| 100 | @implementation I15 : I12 |
| 101 | @end |
| 102 | |
| 103 | @interface ImportSelectorSLoc { } |
| 104 | -(int)addInt:(int)a toInt:(int)b moduloInt:(int)c; // don't crash here |
| 105 | @end |