1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc// rdar://9091389 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc@protocol Fooable 5*f4a2713aSLionel Sambuc- (void)foo; 6*f4a2713aSLionel Sambuc@end 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc@protocol SubFooable <Fooable> 9*f4a2713aSLionel Sambuc@end 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc@interface AClass 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@interface BClass : AClass <SubFooable> 15*f4a2713aSLionel Sambuc@end 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc@implementation BClass 18*f4a2713aSLionel Sambuc- (void)foo { 19*f4a2713aSLionel Sambuc} 20*f4a2713aSLionel Sambuc@end 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambucvoid functionTakingAClassConformingToAProtocol(AClass <Fooable> *instance) { // expected-note {{passing argument to parameter 'instance' here}} 23*f4a2713aSLionel Sambuc} 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambucint main () { 26*f4a2713aSLionel Sambuc AClass *aobject = 0; 27*f4a2713aSLionel Sambuc BClass *bobject = 0; 28*f4a2713aSLionel Sambuc functionTakingAClassConformingToAProtocol(aobject); // expected-warning {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass<Fooable> *'}} 29*f4a2713aSLionel Sambuc functionTakingAClassConformingToAProtocol(bobject); // Shouldn't warn - does implement Fooable 30*f4a2713aSLionel Sambuc return 0; 31*f4a2713aSLionel Sambuc} 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc// rdar://9267196 34*f4a2713aSLionel Sambuc@interface NSObject @end 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc@protocol MyProtocol 37*f4a2713aSLionel Sambuc@end 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc@interface MyClass : NSObject 40*f4a2713aSLionel Sambuc{ 41*f4a2713aSLionel Sambuc} 42*f4a2713aSLionel Sambuc@end 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc@implementation MyClass 45*f4a2713aSLionel Sambuc@end 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc@interface MySubclass : MyClass <MyProtocol> 48*f4a2713aSLionel Sambuc{ 49*f4a2713aSLionel Sambuc} 50*f4a2713aSLionel Sambuc@end 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc@interface MyTestClass : NSObject 53*f4a2713aSLionel Sambuc{ 54*f4a2713aSLionel Sambuc@private 55*f4a2713aSLionel Sambuc NSObject <MyProtocol> *someObj; 56*f4a2713aSLionel Sambuc} 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc@property (nonatomic, assign) NSObject <MyProtocol> *someObj; 59*f4a2713aSLionel Sambuc 60*f4a2713aSLionel Sambuc@end 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc@implementation MyTestClass 63*f4a2713aSLionel Sambuc 64*f4a2713aSLionel Sambuc@synthesize someObj; 65*f4a2713aSLionel Sambuc 66*f4a2713aSLionel Sambuc- (void)someMethod 67*f4a2713aSLionel Sambuc{ 68*f4a2713aSLionel Sambuc MySubclass *foo; 69*f4a2713aSLionel Sambuc [self setSomeObj:foo]; // no warning here! 70*f4a2713aSLionel Sambuc} 71*f4a2713aSLionel Sambuc 72*f4a2713aSLionel Sambuc@end 73