blob: 0d83d47eb4e79ebf3cadb7df6e175eca0efd6d50 [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
17int main() {
18 SEL s = @selector(retain);
19 SEL s1 = @selector(meth1:);
20 SEL s2 = @selector(retainArgument::);
21 SEL s3 = @selector(retainArgument:::::);
22 SEL s4 = @selector(retainArgument:with:);
23 SEL s5 = @selector(meth1:with:with:);
24 SEL s6 = @selector(getEnum:enum:bool:);
25 SEL s7 = @selector(char:float:double:unsigned:short:long:);
26
27 SEL s9 = @selector(:enum:bool:);
Fariborz Jahanianb62f6812007-10-16 20:40:23 +000028}
Stephen Hines651f13c2014-04-23 16:59:28 -070029
30// rdar://15794055
31@interface NSObject @end
32
33@class NSNumber;
34
35@interface XBRecipe : NSObject
36@property (nonatomic, assign) float finalVolume; // expected-note {{method 'setFinalVolume:' declared here}}
37@end
38
39@interface XBDocument : NSObject
40@end
41
42@interface XBDocument ()
43- (void)setFinalVolume:(NSNumber *)finalVolumeNumber; // expected-note {{method 'setFinalVolume:' declared here}}
44@end
45
46@implementation XBDocument
47- (void)setFinalVolume:(NSNumber *)finalVolumeNumber
48{
49 (void)@selector(setFinalVolume:); // expected-warning {{several methods with selector 'setFinalVolume:' of mismatched types are found for the @selector expression}}
50}
51@end