xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/method-lookup.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuctypedef signed char BOOL;
3*f4a2713aSLionel Sambuctypedef int NSInteger;
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@protocol NSObject
6*f4a2713aSLionel Sambuc- (BOOL)isEqual:(id)object;
7*f4a2713aSLionel Sambuc- (BOOL)respondsToSelector:(SEL)s;
8*f4a2713aSLionel Sambuc@end
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface NSObject <NSObject> {}
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@protocol PBXCompletionItem
16*f4a2713aSLionel Sambuc- (NSString *) name;
17*f4a2713aSLionel Sambuc- (NSInteger)priority;
18*f4a2713aSLionel Sambuc- setPriority:(NSInteger)p;
19*f4a2713aSLionel Sambuc@end
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@implementation PBXCodeAssistant // expected-warning{{cannot find interface declaration for 'PBXCodeAssistant'}}
22*f4a2713aSLionel Sambucstatic NSMutableArray * recentCompletions = ((void *)0);
23*f4a2713aSLionel Sambuc+ (float) factorForRecentCompletion:(NSString *) completion
24*f4a2713aSLionel Sambuc{
25*f4a2713aSLionel Sambuc    for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '+completionItems' not found (return type defaults to 'id')}}
26*f4a2713aSLionel Sambuc    {
27*f4a2713aSLionel Sambuc        if ([item respondsToSelector:@selector(setPriority:)])
28*f4a2713aSLionel Sambuc        {
29*f4a2713aSLionel Sambuc            [(id)item setPriority:[item priority] / [PBXCodeAssistant factorForRecentCompletion:[item name]]];
30*f4a2713aSLionel Sambuc        }
31*f4a2713aSLionel Sambuc    }
32*f4a2713aSLionel Sambuc    return 0;
33*f4a2713aSLionel Sambuc}
34*f4a2713aSLionel Sambuc@end
35*f4a2713aSLionel Sambuc
36