1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify %s 2*67e74705SXin Litypedef _Bool BOOL; 3*67e74705SXin Li 4*67e74705SXin Li@interface NSNumber @end 5*67e74705SXin Li 6*67e74705SXin Li@interface NSNumber (NSNumberCreation) 7*67e74705SXin Li+ (NSNumber *)numberWithChar:(char)value; 8*67e74705SXin Li+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value; 9*67e74705SXin Li+ (NSNumber *)numberWithShort:(short)value; 10*67e74705SXin Li+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value; 11*67e74705SXin Li+ (NSNumber *)numberWithInt:(int)value; 12*67e74705SXin Li+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value; 13*67e74705SXin Li+ (NSNumber *)numberWithLong:(long)value; 14*67e74705SXin Li+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value; 15*67e74705SXin Li+ (NSNumber *)numberWithLongLong:(long long)value; 16*67e74705SXin Li+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; 17*67e74705SXin Li+ (NSNumber *)numberWithFloat:(float)value; 18*67e74705SXin Li+ (NSNumber *)numberWithDouble:(double)value; 19*67e74705SXin Li+ (int)numberWithBool:(BOOL)value; // expected-note 2 {{method returns unexpected type 'int' (should be an object type)}} 20*67e74705SXin Li@end 21*67e74705SXin Li 22*67e74705SXin Li@interface NSString 23*67e74705SXin Li+ (char)stringWithUTF8String:(const char *)value; // expected-note 2 {{method returns unexpected type 'char' (should be an object type)}} 24*67e74705SXin Li@end 25*67e74705SXin Li 26*67e74705SXin Li@interface NSArray 27*67e74705SXin Li@end 28*67e74705SXin Li 29*67e74705SXin Li@interface NSArray (NSArrayCreation) 30*67e74705SXin Li+ (id)arrayWithObjects:(const int [])objects // expected-note 2 {{first parameter has unexpected type 'const int *' (should be 'const id *')}} 31*67e74705SXin Li count:(unsigned long)cnt; 32*67e74705SXin Li@end 33*67e74705SXin Li 34*67e74705SXin Li@interface NSDictionary 35*67e74705SXin Li+ (id)dictionaryWithObjects:(const id [])objects 36*67e74705SXin Li forKeys:(const int [])keys // expected-note 2 {{second parameter has unexpected type 'const int *' (should be 'const id *')}} 37*67e74705SXin Li count:(unsigned long)cnt; 38*67e74705SXin Li@end 39*67e74705SXin Li 40*67e74705SXin Li// All tests are doubled to make sure that a bad method is not saved 41*67e74705SXin Li// and then used un-checked. 42*67e74705SXin Livoid test_sig() { 43*67e74705SXin Li (void)@__objc_yes; // expected-error{{literal construction method 'numberWithBool:' has incompatible signature}} 44*67e74705SXin Li (void)@__objc_yes; // expected-error{{literal construction method 'numberWithBool:' has incompatible signature}} 45*67e74705SXin Li id array = @[ @17 ]; // expected-error{{literal construction method 'arrayWithObjects:count:' has incompatible signature}} 46*67e74705SXin Li id array2 = @[ @17 ]; // expected-error{{literal construction method 'arrayWithObjects:count:' has incompatible signature}} 47*67e74705SXin Li id dict = @{ @"hello" : @17 }; // expected-error{{literal construction method 'dictionaryWithObjects:forKeys:count:' has incompatible signature}} 48*67e74705SXin Li id dict2 = @{ @"hello" : @17 }; // expected-error{{literal construction method 'dictionaryWithObjects:forKeys:count:' has incompatible signature}} 49*67e74705SXin Li id str = @("hello"); // expected-error{{literal construction method 'stringWithUTF8String:' has incompatible signature}} 50*67e74705SXin Li id str2 = @("hello"); // expected-error{{literal construction method 'stringWithUTF8String:' has incompatible signature}} 51*67e74705SXin Li} 52