Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // RUN: cp %s %t |
| 3 | // RUN: not %clang_cc1 -fsyntax-only -fixit -x objective-c %t |
| 4 | // RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c %t |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 5 | |
| 6 | typedef unsigned char BOOL; |
| 7 | |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 8 | @interface NSObject |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 9 | @end |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 10 | |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 11 | @interface NSNumber : NSObject |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 12 | + (NSNumber *)numberWithChar:(char)value; |
| 13 | + (NSNumber *)numberWithUnsignedChar:(unsigned char)value; |
| 14 | + (NSNumber *)numberWithShort:(short)value; |
| 15 | + (NSNumber *)numberWithUnsignedShort:(unsigned short)value; |
| 16 | + (NSNumber *)numberWithInt:(int)value; |
| 17 | + (NSNumber *)numberWithUnsignedInt:(unsigned int)value; |
| 18 | + (NSNumber *)numberWithLong:(long)value; |
| 19 | + (NSNumber *)numberWithUnsignedLong:(unsigned long)value; |
| 20 | + (NSNumber *)numberWithLongLong:(long long)value; |
| 21 | + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; |
| 22 | + (NSNumber *)numberWithFloat:(float)value; |
| 23 | + (NSNumber *)numberWithDouble:(double)value; |
| 24 | + (NSNumber *)numberWithBool:(BOOL)value; |
| 25 | @end |
| 26 | |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 27 | @interface NSArray : NSObject |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 28 | + (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; |
| 29 | @end |
| 30 | |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 31 | @interface NSDictionary : NSObject |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 32 | + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; |
| 33 | @end |
| 34 | |
Jordan Rose | 9f63a45 | 2012-06-08 21:14:25 +0000 | [diff] [blame] | 35 | @interface NSString : NSObject |
| 36 | @end |
| 37 | |
Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 38 | void fixes() { |
| 39 | id arr = @[ |
| 40 | 17, // expected-error{{numeric literal must be prefixed by '@' in a collection}} |
| 41 | 'a', // expected-error{{character literal must be prefixed by '@'}} |
| 42 | "blah" // expected-error{{string literal must be prefixed by '@'}} |
| 43 | ]; |
| 44 | } |