complete-kvc.m revision 577cdfdb20840350e841a483df630237326126d5
1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// Test for code completions related to Key-Value Coding and Key-Value Observing.
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// Since this test is line- and column-sensitive, the run lines are at the end.
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtypedef signed char BOOL;
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface NSSet
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface NSMutableSet : NSSet
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface MySet : NSMutableSet
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface NSArray
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface NSMutableArray : NSArray
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface MyArray : NSMutableArray
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@interface MyClass
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property int intProperty;
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property BOOL boolProperty;
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property int* intPointerProperty;
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property NSSet *setProperty;
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property NSMutableSet *mutableSetProperty;
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property MySet *mySetProperty;
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property NSArray *arrayProperty;
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property NSMutableArray *mutableArrayProperty;
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@property MyArray *myArrayProperty;
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@implementation MyClass
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org- (int)intProperty { return 0; }
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org- (void)setIntProperty:(int)newValue { }
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org+ (NSSet *)keyPathsForValuesAffectingIntProperty { return 0; }
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org@end
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// RUN: c-index-test -code-completion-at=%s:39:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText addMutableArrayPropertyObject:}{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{Text object} (55)
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText addMutableSetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (40)
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText arrayProperty} (40)
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText arrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText boolProperty} (40)
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText boolPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfArrayProperty} (40)
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfBoolProperty} (55)
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfSetProperty} (40)
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSEnumerator *}{RightParen )}{TypedText enumeratorOfMutableArrayProperty} (55)
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSEnumerator *}{RightParen )}{TypedText enumeratorOfMutableSetProperty} (40)
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText getMyArrayProperty:}{LeftParen (}{Placeholder object-type}{Text  **}{RightParen )}{Text buffer}{HorizontalSpace  }{TypedText range:}{LeftParen (}{Text NSRange}{RightParen )}{Text inRange} (40)
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText getMySetProperty:}{LeftParen (}{Placeholder object-type}{Text  **}{RightParen )}{Text buffer}{HorizontalSpace  }{TypedText range:}{LeftParen (}{Text NSRange}{RightParen )}{Text inRange} (55)
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertIntProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array}{HorizontalSpace  }{TypedText atIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes} (55)
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertMutableArrayProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array}{HorizontalSpace  }{TypedText atIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes} (40)
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertObject:}{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{Text object}{HorizontalSpace  }{TypedText inMyArrayPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index} (40)
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertObject:}{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{Text object}{HorizontalSpace  }{TypedText inMySetPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index} (55)
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText intersectMySetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (40)
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText intersectSetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (55)
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int *}{RightParen )}{TypedText intPointerProperty} (40)
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText intProperty} (40)
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText isBoolProperty} (40)
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText isIntProperty} (40)
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{TypedText memberOfMyArrayProperty:}{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{Text object} (55)
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{TypedText memberOfMySetProperty:}{LeftParen (}{Placeholder object-type}{Text  *}{RightParen )}{Text object} (40)
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSMutableArray *}{RightParen )}{TypedText mutableArrayProperty} (40)
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSMutableSet *}{RightParen )}{TypedText mutableSetProperty} (40)
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText mutableSetPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text MyArray *}{RightParen )}{TypedText myArrayProperty} (40)
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText myArrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText objectInMutableSetPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (55)
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText objectInMyArrayPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (40)
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeMyArrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeMySetPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeObjectFromIntPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (55)
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeObjectFromMutableArrayPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (40)
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceMyArrayPropertyAtIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes}{HorizontalSpace  }{TypedText withMyArrayProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array} (40)
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceMySetPropertyAtIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes}{HorizontalSpace  }{TypedText withMySetProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array} (55)
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceObjectInMyArrayPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index}{HorizontalSpace  }{TypedText withObject:}{LeftParen (}{Text id}{RightParen )}{Text object} (40)
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceObjectInMySetPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index}{HorizontalSpace  }{TypedText withObject:}{LeftParen (}{Text id}{RightParen )}{Text object} (55)
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// RUN: c-index-test -code-completion-at=%s:41:3 %s | FileCheck -check-prefix=CHECK-CC2 %s
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// CHECK-CC2: ObjCInstanceMethodDecl:{LeftParen (}{Text NSSet *}{RightParen )}{TypedText keyPathsForValuesAffectingMutableArrayProperty} (40)
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org