Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 1 | @protocol NSObject |
| 2 | @end |
| 3 | |
| 4 | @interface NSObject |
| 5 | @end |
| 6 | |
| 7 | @interface Test<T : id, U : NSObject *> : NSObject |
| 8 | { |
| 9 | @public |
| 10 | U myVar; |
| 11 | } |
| 12 | -(U)getit:(T)val; |
| 13 | -(void)apply:(void(^)(T, U))block; |
Douglas Gregor | 9b7b3e9 | 2015-07-07 06:20:27 +0000 | [diff] [blame] | 14 | -(void)apply2:(void(^_Nonnull)(T, U))block; |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 15 | |
| 16 | @property (strong) T prop; |
| 17 | @end |
| 18 | |
| 19 | @interface MyClsA : NSObject |
| 20 | @end |
| 21 | @interface MyClsB : NSObject |
| 22 | @end |
| 23 | |
| 24 | void test1(Test<MyClsA*, MyClsB*> *obj) { |
| 25 | [obj ]; |
| 26 | obj.; |
| 27 | obj->; |
| 28 | } |
| 29 | |
| 30 | void test2(Test *obj) { |
| 31 | [obj ]; |
| 32 | obj.; |
| 33 | obj->; |
| 34 | } |
| 35 | |
Douglas Gregor | 9b7b3e9 | 2015-07-07 06:20:27 +0000 | [diff] [blame] | 36 | @implementation Test |
| 37 | -(id)getit:(id)val {} |
| 38 | @end |
| 39 | |
Douglas Gregor | cedcd9f | 2015-07-07 06:20:36 +0000 | [diff] [blame] | 40 | void test3() { |
| 41 | Test<> t; |
| 42 | NSObject<> n; |
| 43 | } |
| 44 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 45 | // RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-CC0 %s |
| 46 | // CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(MyClsA *, MyClsB *)block} (35) |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 47 | // CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(MyClsA *, MyClsB *)block} (35) |
| 48 | // CHECK-CC0: ObjCInstanceMethodDecl:{ResultType MyClsB *}{TypedText getit:}{Placeholder (MyClsA *)} (35) |
| 49 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 50 | // RUN: c-index-test -code-completion-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 51 | // CHECK-CC1: ObjCPropertyDecl:{ResultType MyClsA *}{TypedText prop} (35) |
| 52 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 53 | // RUN: c-index-test -code-completion-at=%s:27:8 %s | FileCheck -check-prefix=CHECK-CC2 %s |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 54 | // CHECK-CC2: ObjCIvarDecl:{ResultType MyClsB *}{TypedText myVar} (35) |
| 55 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 56 | // RUN: c-index-test -code-completion-at=%s:31:8 %s | FileCheck -check-prefix=CHECK-CC3 %s |
| 57 | // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(id, NSObject *)block} (35) |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 58 | // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(id, NSObject *)block} (35) |
| 59 | // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType __kindof NSObject *}{TypedText getit:}{Placeholder (id)} (35) |
| 60 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 61 | // RUN: c-index-test -code-completion-at=%s:32:7 %s | FileCheck -check-prefix=CHECK-CC4 %s |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 62 | // CHECK-CC4: ObjCPropertyDecl:{ResultType id}{TypedText prop} (35) |
| 63 | |
Douglas Gregor | 4c850f3 | 2015-07-07 06:20:22 +0000 | [diff] [blame] | 64 | // RUN: c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s |
Douglas Gregor | c3425b1 | 2015-07-07 06:20:19 +0000 | [diff] [blame] | 65 | // CHECK-CC5: ObjCIvarDecl:{ResultType __kindof NSObject *}{TypedText myVar} (35) |
Douglas Gregor | 9b7b3e9 | 2015-07-07 06:20:27 +0000 | [diff] [blame] | 66 | |
| 67 | // RUN: c-index-test -code-completion-at=%s:37:2 %s | FileCheck -check-prefix=CHECK-CC6 %s |
Argyrios Kyrtzidis | f0917ab | 2015-07-24 17:00:19 +0000 | [diff] [blame] | 68 | // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply2}{TypedText :}{LeftParen (}{Text void (^)(id, NSObject *)}{RightParen )}{Text block} (40) |
Douglas Gregor | 9b7b3e9 | 2015-07-07 06:20:27 +0000 | [diff] [blame] | 69 | // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply}{TypedText :}{LeftParen (}{Text void (^)(id, NSObject *)}{RightParen )}{Text block} (40) |
| 70 | // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text NSObject *}{RightParen )}{TypedText getit}{TypedText :}{LeftParen (}{Text id}{RightParen )}{Text val} (40) |
| 71 | // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText prop} (40) |
Douglas Gregor | cedcd9f | 2015-07-07 06:20:36 +0000 | [diff] [blame] | 72 | |
| 73 | // RUN: c-index-test -code-completion-at=%s:41:8 %s | FileCheck -check-prefix=CHECK-CC7 %s |
| 74 | // CHECK-CC7: ObjCInterfaceDecl:{TypedText MyClsA} |
| 75 | // RUN: c-index-test -code-completion-at=%s:42:12 %s > %t.out |
| 76 | // RUN: FileCheck -input-file=%t.out -check-prefix=CHECK-CC8 %s |
| 77 | // RUN: FileCheck -input-file=%t.out -check-prefix=CHECK-CC9 %s |
| 78 | // CHECK-CC8: ObjCProtocolDecl:{TypedText NSObject} |
| 79 | // CHECK-CC9-NOT: ObjCInterfaceDecl:{TypedText MyClsA} |