interface2.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. float ivar2;
  15. }
  16. @end
  17. // Superclass mismatch
  18. @interface I4 : I1 {
  19. }
  20. @end
  21. // Methods match
  22. @interface I5
  23. + (float)bar;
  24. - (int)foo;
  25. @end
  26. // Method mismatch
  27. @interface I6
  28. + (float)foo;
  29. @end
  30. // Method mismatch
  31. @interface I7
  32. - (int)foo;
  33. + (int)bar:(float)x;
  34. @end
  35. // Method mismatch
  36. @interface I8
  37. - (int)foo;
  38. + (int)bar:(float)x, ...;
  39. @end
  40. // Matching protocol
  41. @protocol P0
  42. + (int)foo;
  43. - (int)bar:(float)x;
  44. @end
  45. // Protocol with mismatching method
  46. @protocol P1
  47. + (int)foo;
  48. - (int)bar:(double)x;
  49. @end
  50. // Interface with protocol
  51. @interface I9 <P0>
  52. + (int)foo;
  53. - (int)bar:(float)x;
  54. @end
  55. // Protocol with protocol
  56. @protocol P2 <P0>
  57. - (float)wibble:(int)a1 second:(int)a2;
  58. @end
  59. // Forward-declared interface
  60. @class I10; @interface I12 @end
  61. @interface I11
  62. @end
  63. // Forward-declared protocols
  64. @protocol P3, P4;
  65. @protocol P5
  66. - (double)honk:(int)a;
  67. @end
  68. // Interface with implementation
  69. @interface I13
  70. @end
  71. @implementation I13
  72. @end
  73. @interface I13b
  74. @end
  75. @implementation I13b
  76. @end
  77. // Implementation by itself
  78. @implementation I14 : I12
  79. @end
  80. @implementation I15 : I11
  81. @end