1// RUN: %clang_cc1 -pedantic -fsyntax-only -verify -Wno-objc-root-class %s
2typedef signed char BOOL;
3
4@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
5
6@protocol NSObject
7- (BOOL)isEqual:(id)object;
8@end
9
10@protocol NSCoding
11- (void)encodeWithCoder:(NSCoder *)aCoder;
12@end
13
14@interface NSObject <NSObject> {}
15@end
16
17typedef float CGFloat;
18
19@interface NSResponder : NSObject <NSCoding> {}
20@end
21
22@protocol XCSelectionSource;
23
24@interface XCSelection : NSResponder {}
25- (NSObject <XCSelectionSource> *) source;
26@end
27
28extern NSString * const XCActiveSelectionLevel;
29
30@interface XCActionManager : NSResponder {}
31+defaultActionManager;
32-selectionAtLevel:(NSString *const)s;
33@end
34
35@implementation XDMenuItemsManager // expected-warning {{cannot find interface declaration for 'XDMenuItemsManager'}}
36+ (void)initialize {
37  id<XCSelectionSource, NSObject> source =
38    [[[XCActionManager defaultActionManager] selectionAtLevel:XCActiveSelectionLevel] source];
39}
40@end
41
42@protocol NSTextStorageDelegate;
43@class NSNotification;
44
45@interface NSTextStorage : NSObject
46
47- (void)setDelegate:(id <NSTextStorageDelegate>)delegate; // expected-note{{passing argument to parameter 'delegate' here}}
48- (id <NSTextStorageDelegate>)delegate;
49
50@end
51
52@protocol NSTextStorageDelegate <NSObject>
53@optional
54
55- (void)textStorageWillProcessEditing:(NSNotification *)notification;
56- (void)textStorageDidProcessEditing:(NSNotification *)notification;
57
58@end
59
60@interface SKTText : NSObject {
61    @private
62
63
64    NSTextStorage *_contents;
65}
66@end
67
68@implementation SKTText
69
70
71- (NSTextStorage *)contents {
72 [_contents setDelegate:self]; // expected-warning {{sending 'SKTText *' to parameter of incompatible type 'id<NSTextStorageDelegate>'}}
73 return 0;
74}
75
76@end
77