51 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface A4- (void) setMoo: (int) x; // expected-note {{previous definition is here}}5- (int) setMoo1: (int) x; // expected-note {{previous definition is here}}6- (int) setOk : (int) x : (double) d;7@end8 9@implementation A 10-(void) setMoo: (float) x {} // expected-warning {{conflicting parameter types in implementation of 'setMoo:': 'int' vs 'float'}}11- (char) setMoo1: (int) x { return 0; } // expected-warning {{conflicting return type in implementation of 'setMoo1:': 'int' vs 'char'}}12- (int) setOk : (int) x : (double) d { return 0; }13@end14 15 16 17@interface C18+ (void) cMoo: (int) x; // expected-note 2 {{previous definition is here}}19@end20 21@implementation C 22+(float) cMoo: // expected-warning {{conflicting return type in implementation of 'cMoo:': 'void' vs 'float'}}23 (float) x { return 0; } // expected-warning {{conflicting parameter types in implementation of 'cMoo:': 'int' vs 'float'}}24@end25 26 27@interface A(CAT)28- (void) setCat: (int) x; // expected-note 2 {{previous definition is here}}29+ (void) cCat: (int) x; // expected-note {{previous definition is here}}30@end31 32@implementation A(CAT) 33-(float) setCat: // expected-warning {{conflicting return type in implementation of 'setCat:': 'void' vs 'float'}}34(float) x { return 0; } // expected-warning {{conflicting parameter types in implementation of 'setCat:': 'int' vs 'float'}}35+ (int) cCat: (int) x { return 0; } // expected-warning {{conflicting return type in implementation of 'cCat:': 'void' vs 'int'}}36@end37 38// test that when implementation implements method in a category, types match.39@interface testObject {}40@end41 42@interface testObject(Category)43- (float)returnCGFloat; // expected-note {{previous definition is here}}44@end45 46@implementation testObject47- (double)returnCGFloat { // expected-warning {{conflicting return type in implementation of 'returnCGFloat': 'float' vs 'double'}}48 return 0.0;49}50@end51