interface1.m 1.3 KB

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