blob: 4efa0d71178793d895a705b9291a377eb8922778 [file] [log] [blame]
Stephen Hines651f13c2014-04-23 16:59:28 -07001// RUN: %clang_cc1 -Wselector-type-mismatch -verify %s
Steve Naroff84c43102009-02-11 20:43:13 +00002
Fariborz Jahanian835ed7f2009-08-22 21:13:55 +00003@interface I
Stephen Hines651f13c2014-04-23 16:59:28 -07004- (id) compare: (char) arg1; // expected-note {{method 'compare:' declared here}}
Fariborz Jahanian8b789132011-02-04 23:19:27 +00005- length;
Fariborz Jahanian835ed7f2009-08-22 21:13:55 +00006@end
7
Fariborz Jahanian1e99a772011-02-04 23:30:23 +00008@interface J
Stephen Hines651f13c2014-04-23 16:59:28 -07009- (id) compare: (id) arg1; // expected-note {{method 'compare:' declared here}}
Fariborz Jahanian1e99a772011-02-04 23:30:23 +000010@end
11
Fariborz Jahanian8b789132011-02-04 23:19:27 +000012SEL func()
Fariborz Jahanian835ed7f2009-08-22 21:13:55 +000013{
Stephen Hines651f13c2014-04-23 16:59:28 -070014 return @selector(compare:); // expected-warning {{several methods with selector 'compare:' of mismatched types are found for the @selector expression}}
Fariborz Jahanian1e99a772011-02-04 23:30:23 +000015}
16
Stephen Hinesc568f1e2014-07-21 00:47:37 -070017// rdar://16458579
18void Test16458579() {
19 SEL s = @selector((retain));
20 SEL s1 = @selector((meth1:));
21 SEL s2 = @selector((retainArgument::));
22 SEL s3 = @selector((retainArgument:::::));
23 SEL s4 = @selector((retainArgument:with:));
24 SEL s5 = @selector((meth1:with:with:));
25 SEL s6 = @selector((getEnum:enum:bool:));
26 SEL s7 = @selector((char:float:double:unsigned:short:long:));
27 SEL s9 = @selector((:enum:bool:));
28}
Fariborz Jahanian1e99a772011-02-04 23:30:23 +000029int main() {
30 SEL s = @selector(retain);
31 SEL s1 = @selector(meth1:);
32 SEL s2 = @selector(retainArgument::);
33 SEL s3 = @selector(retainArgument:::::);
34 SEL s4 = @selector(retainArgument:with:);
35 SEL s5 = @selector(meth1:with:with:);
36 SEL s6 = @selector(getEnum:enum:bool:);
37 SEL s7 = @selector(char:float:double:unsigned:short:long:);
38
39 SEL s9 = @selector(:enum:bool:);
Fariborz Jahanianb62f6812007-10-16 20:40:23 +000040}
Stephen Hines651f13c2014-04-23 16:59:28 -070041
42// rdar://15794055
43@interface NSObject @end
44
45@class NSNumber;
46
47@interface XBRecipe : NSObject
48@property (nonatomic, assign) float finalVolume; // expected-note {{method 'setFinalVolume:' declared here}}
49@end
50
51@interface XBDocument : NSObject
52@end
53
54@interface XBDocument ()
55- (void)setFinalVolume:(NSNumber *)finalVolumeNumber; // expected-note {{method 'setFinalVolume:' declared here}}
56@end
57
58@implementation XBDocument
59- (void)setFinalVolume:(NSNumber *)finalVolumeNumber
60{
61 (void)@selector(setFinalVolume:); // expected-warning {{several methods with selector 'setFinalVolume:' of mismatched types are found for the @selector expression}}
62}
63@end