]> granicus.if.org Git - clang/commitdiff
Add more tests for NSArray/NSDictionary literals
authorAlex Denisov <1101.debian@gmail.com>
Tue, 17 Feb 2015 06:43:10 +0000 (06:43 +0000)
committerAlex Denisov <1101.debian@gmail.com>
Tue, 17 Feb 2015 06:43:10 +0000 (06:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229470 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaObjC/objc-array-literal.m
test/SemaObjC/objc-dictionary-literal.m

index 706207df74826bc6023b06eaa27ee83c362ac462..2971fcc453992fd4d96f1839bf55e81386e0906a 100644 (file)
@@ -9,6 +9,18 @@ typedef unsigned long NSUInteger;
 typedef unsigned int NSUInteger;
 #endif
 
+void checkNSArrayUnavailableDiagnostic() {
+  id obj;
+  id arr = @[obj]; // expected-error {{NSArray must be available to use Objective-C array literals}}
+}
+
+@class NSArray;
+
+void checkNSArrayFDDiagnostic() {
+  id obj;
+  id arr = @[obj]; // expected-error {{declaration of 'arrayWithObjects:count:' is missing in NSArray class}}
+}
+
 @class NSString;
 
 extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
index f9fd57f2dae2d7fe4e32af4d032d5745432475b6..87f127f9281eb803ceb87e127e3a2e02948321b3 100644 (file)
@@ -5,6 +5,20 @@
 
 #define nil ((void *)0)
 
+void checkNSDictionaryUnavailableDiagnostic() {
+  id key;
+  id value;
+  id dict = @{ key : value }; // expected-error {{NSDictionary must be available to use Objective-C dictionary literals}}
+}
+
+@class NSDictionary;
+
+void checkNSDictionaryFDDiagnostic() {
+  id key;
+  id value;
+  id dic = @{ key : value }; // expected-error {{declaration of 'dictionaryWithObjects:forKeys:count:' is missing in NSDictionary class}}
+}
+
 @interface NSNumber
 + (NSNumber *)numberWithChar:(char)value;
 + (NSNumber *)numberWithInt:(int)value;