summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/method-lookup.m
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjC/method-lookup.m')
-rw-r--r--clang/test/SemaObjC/method-lookup.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/method-lookup.m b/clang/test/SemaObjC/method-lookup.m
new file mode 100644
index 0000000..13e2d7f
--- /dev/null
+++ b/clang/test/SemaObjC/method-lookup.m
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+typedef signed char BOOL;
+typedef int NSInteger;
+
+@protocol NSObject
+- (BOOL)isEqual:(id)object;
+- (BOOL)respondsToSelector:(SEL)s;
+@end
+
+@interface NSObject <NSObject> {}
+@end
+
+@class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
+
+@protocol PBXCompletionItem
+- (NSString *) name;
+- (NSInteger)priority;
+- setPriority:(NSInteger)p;
+@end
+
+@implementation PBXCodeAssistant // expected-warning{{cannot find interface declaration for 'PBXCodeAssistant'}}
+static NSMutableArray * recentCompletions = ((void *)0);
++ (float) factorForRecentCompletion:(NSString *) completion
+{
+ for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '+completionItems' not found (return type defaults to 'id')}}
+ {
+ if ([item respondsToSelector:@selector(setPriority:)])
+ {
+ [(id)item setPriority:[item priority] / [PBXCodeAssistant factorForRecentCompletion:[item name]]];
+ }
+ }
+ return 0;
+}
+@end
+