xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/selector-1.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1  -Wselector-type-mismatch -verify %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc@interface I
4*0a6a1f1dSLionel Sambuc- (id) compare: (char) arg1; // expected-note {{method 'compare:' declared here}}
5f4a2713aSLionel Sambuc- length;
6f4a2713aSLionel Sambuc@end
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc@interface J
9*0a6a1f1dSLionel Sambuc- (id) compare: (id) arg1; // expected-note {{method 'compare:' declared here}}
10f4a2713aSLionel Sambuc@end
11f4a2713aSLionel Sambuc
12f4a2713aSLionel SambucSEL func()
13f4a2713aSLionel Sambuc{
14*0a6a1f1dSLionel Sambuc	return @selector(compare:);	// expected-warning {{several methods with selector 'compare:' of mismatched types are found for the @selector expression}}
15f4a2713aSLionel Sambuc}
16f4a2713aSLionel Sambuc
17*0a6a1f1dSLionel Sambuc// rdar://16458579
18*0a6a1f1dSLionel Sambucvoid Test16458579() {
19*0a6a1f1dSLionel Sambuc SEL s = @selector((retain));
20*0a6a1f1dSLionel Sambuc SEL s1 = @selector((meth1:));
21*0a6a1f1dSLionel Sambuc SEL s2 = @selector((retainArgument::));
22*0a6a1f1dSLionel Sambuc SEL s3 = @selector((retainArgument:::::));
23*0a6a1f1dSLionel Sambuc SEL s4 = @selector((retainArgument:with:));
24*0a6a1f1dSLionel Sambuc SEL s5 = @selector((meth1:with:with:));
25*0a6a1f1dSLionel Sambuc SEL s6 = @selector((getEnum:enum:bool:));
26*0a6a1f1dSLionel Sambuc SEL s7 = @selector((char:float:double:unsigned:short:long:));
27*0a6a1f1dSLionel Sambuc SEL s9 = @selector((:enum:bool:));
28*0a6a1f1dSLionel Sambuc}
29f4a2713aSLionel Sambucint main() {
30f4a2713aSLionel Sambuc SEL s = @selector(retain);
31f4a2713aSLionel Sambuc SEL s1 = @selector(meth1:);
32f4a2713aSLionel Sambuc SEL s2 = @selector(retainArgument::);
33f4a2713aSLionel Sambuc SEL s3 = @selector(retainArgument:::::);
34f4a2713aSLionel Sambuc SEL s4 = @selector(retainArgument:with:);
35f4a2713aSLionel Sambuc SEL s5 = @selector(meth1:with:with:);
36f4a2713aSLionel Sambuc SEL s6 = @selector(getEnum:enum:bool:);
37f4a2713aSLionel Sambuc SEL s7 = @selector(char:float:double:unsigned:short:long:);
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambuc SEL s9 = @selector(:enum:bool:);
40f4a2713aSLionel Sambuc}
41*0a6a1f1dSLionel Sambuc
42*0a6a1f1dSLionel Sambuc// rdar://15794055
43*0a6a1f1dSLionel Sambuc@interface NSObject @end
44*0a6a1f1dSLionel Sambuc
45*0a6a1f1dSLionel Sambuc@class NSNumber;
46*0a6a1f1dSLionel Sambuc
47*0a6a1f1dSLionel Sambuc@interface XBRecipe : NSObject
48*0a6a1f1dSLionel Sambuc@property (nonatomic, assign) float finalVolume; // expected-note {{method 'setFinalVolume:' declared here}}
49*0a6a1f1dSLionel Sambuc@end
50*0a6a1f1dSLionel Sambuc
51*0a6a1f1dSLionel Sambuc@interface XBDocument : NSObject
52*0a6a1f1dSLionel Sambuc@end
53*0a6a1f1dSLionel Sambuc
54*0a6a1f1dSLionel Sambuc@interface XBDocument ()
55*0a6a1f1dSLionel Sambuc- (void)setFinalVolume:(NSNumber *)finalVolumeNumber; // expected-note {{method 'setFinalVolume:' declared here}}
56*0a6a1f1dSLionel Sambuc@end
57*0a6a1f1dSLionel Sambuc
58*0a6a1f1dSLionel Sambuc@implementation XBDocument
59*0a6a1f1dSLionel Sambuc- (void)setFinalVolume:(NSNumber *)finalVolumeNumber
60*0a6a1f1dSLionel Sambuc{
61*0a6a1f1dSLionel Sambuc    (void)@selector(setFinalVolume:); // expected-warning {{several methods with selector 'setFinalVolume:' of mismatched types are found for the @selector expression}}
62*0a6a1f1dSLionel Sambuc}
63*0a6a1f1dSLionel Sambuc@end
64