xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/method-lookup-4.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc@interface NSObject {}
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@end
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@interface MyClass : NSObject {}
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@end
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@interface MyClass (MyCategorie)
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc@end
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc@interface MySubClass : MyClass {}
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@end
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc@interface MySubSubClass : MySubClass {}
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@implementation NSObject (NSObjectCategory)
25*f4a2713aSLionel Sambuc- (void)rootMethod {}
26*f4a2713aSLionel Sambuc@end
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc@implementation MyClass
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc+ (void)myClassMethod { }
31*f4a2713aSLionel Sambuc- (void)myMethod { }
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc@end
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc@implementation MyClass (MyCategorie)
36*f4a2713aSLionel Sambuc+ (void)myClassCategoryMethod { }
37*f4a2713aSLionel Sambuc- (void)categoryMethod {}
38*f4a2713aSLionel Sambuc@end
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambuc@implementation MySubClass
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc- (void)mySubMethod {}
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc- (void)myTest {
45*f4a2713aSLionel Sambuc  [self mySubMethod];
46*f4a2713aSLionel Sambuc  // should lookup method in superclass implementation if available
47*f4a2713aSLionel Sambuc  [self myMethod];
48*f4a2713aSLionel Sambuc  [super myMethod];
49*f4a2713aSLionel Sambuc
50*f4a2713aSLionel Sambuc  [self categoryMethod];
51*f4a2713aSLionel Sambuc  [super categoryMethod];
52*f4a2713aSLionel Sambuc
53*f4a2713aSLionel Sambuc  // instance method of root class
54*f4a2713aSLionel Sambuc  [MyClass rootMethod];
55*f4a2713aSLionel Sambuc
56*f4a2713aSLionel Sambuc  [MyClass myClassMethod];
57*f4a2713aSLionel Sambuc  [MySubClass myClassMethod];
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc  [MyClass myClassCategoryMethod];
60*f4a2713aSLionel Sambuc  [MySubClass myClassCategoryMethod];
61*f4a2713aSLionel Sambuc}
62*f4a2713aSLionel Sambuc
63*f4a2713aSLionel Sambuc@end
64