[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaObjC / parameterized_classes_collection_literal.m
blob472746e09db9eba5124236c43b6798d6c8ce1f84
1 // RUN: %clang_cc1  -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -x objective-c++  -fsyntax-only -verify %s
4 #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
5 typedef unsigned long NSUInteger;
6 #else
7 typedef unsigned int NSUInteger;
8 #endif
10 @protocol NSObject
11 @end
13 @protocol NSCopying
14 @end
16 __attribute__((objc_root_class))
17 @interface NSObject <NSObject>
18 @end
20 @interface NSString : NSObject <NSCopying>
21 @end
23 @interface NSNumber : NSObject <NSCopying>
24 + (NSNumber *)numberWithInt:(int)value;
25 @end
27 @interface NSArray<T> : NSObject <NSCopying>
28 + (instancetype)arrayWithObjects:(const T [])objects count:(NSUInteger)cnt;
29 @end
31 @interface NSDictionary<K, V> : NSObject <NSCopying>
32 + (instancetype)dictionaryWithObjects:(const V [])objects forKeys:(const K [])keys count:(NSUInteger)cnt;
33 @end
35 void testArrayLiteral(void) {
36   NSArray<NSString *> *array1 = @[@"hello",
37                                    @1, // expected-warning{{of type 'NSNumber *' is not compatible with array element type 'NSString *'}}
38                                   @"world",
39                                   @[@1, @2]]; // expected-warning{{of type 'NSArray *' is not compatible with array element type 'NSString *'}}
41   NSArray<NSArray<NSString *> *> *array2 = @[@[@"hello", @"world"],
42                                               @"blah", // expected-warning{{object of type 'NSString *' is not compatible with array element type 'NSArray<NSString *> *'}}
43                                              @[@1]]; // expected-warning{{object of type 'NSNumber *' is not compatible with array element type 'NSString *'}}
46 void testDictionaryLiteral(void) {
47   NSDictionary<NSString *, NSNumber *> *dict1 = @{
48     @"hello" : @17,
49     @18 : @18, // expected-warning{{object of type 'NSNumber *' is not compatible with dictionary key type 'NSString *'}}
50     @"world" : @"blah" // expected-warning{{object of type 'NSString *' is not compatible with dictionary value type 'NSNumber *'}}
51   };