1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -DNON_FIXITS -verify -Wno-objc-root-class %s 2*67e74705SXin Li// RUN: cp %s %t 3*67e74705SXin Li// RUN: not %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fixit -Wno-objc-root-class %t 4*67e74705SXin Li// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -pedantic -Werror -Wno-objc-root-class %t 5*67e74705SXin Li// RUN: grep "@implementation Sub3" %t 6*67e74705SXin Li 7*67e74705SXin Li@interface NSString // expected-note 2{{'NSString' declared here}} 8*67e74705SXin Li+ (int)method:(int)x; 9*67e74705SXin Li@end 10*67e74705SXin Li 11*67e74705SXin Livoid test() { 12*67e74705SXin Li NSstring *str = @"A string"; // expected-error{{unknown type name 'NSstring'; did you mean 'NSString'?}} 13*67e74705SXin Li} 14*67e74705SXin Li 15*67e74705SXin Li@protocol P1 16*67e74705SXin Li@optional 17*67e74705SXin Li@property int *sprop; // expected-note{{'sprop' declared here}} 18*67e74705SXin Li@end 19*67e74705SXin Li 20*67e74705SXin Li@interface A 21*67e74705SXin Li{ 22*67e74705SXin Li int his_ivar; // expected-note 2{{'his_ivar' declared here}} 23*67e74705SXin Li float wibble; 24*67e74705SXin Li} 25*67e74705SXin Li- (void)methodA; 26*67e74705SXin Li+ (void)methodA; 27*67e74705SXin Li@property int his_prop; // expected-note{{'his_prop' declared here}} 28*67e74705SXin Li@end 29*67e74705SXin Li 30*67e74705SXin Li@interface B : A <P1> 31*67e74705SXin Li{ 32*67e74705SXin Li int her_ivar; // expected-note 2{{'her_ivar' declared here}} 33*67e74705SXin Li} 34*67e74705SXin Li 35*67e74705SXin Li@property int her_prop; // expected-note{{'her_prop' declared here}} 36*67e74705SXin Li- (void)inst_method1:(int)a; 37*67e74705SXin Li+ (void)class_method1; 38*67e74705SXin Li@end 39*67e74705SXin Li 40*67e74705SXin Li@implementation A 41*67e74705SXin Li@synthesize his_prop = his_ivar; 42*67e74705SXin Li- (void)methodA { } 43*67e74705SXin Li+ (void)methodA { } 44*67e74705SXin Li@end 45*67e74705SXin Li 46*67e74705SXin Li@implementation B 47*67e74705SXin Li@synthesize her_prop = her_ivar; 48*67e74705SXin Li 49*67e74705SXin Li-(void)inst_method1:(int)a { 50*67e74705SXin Li herivar = a; // expected-error{{use of undeclared identifier 'herivar'; did you mean 'her_ivar'?}} 51*67e74705SXin Li hisivar = a; // expected-error{{use of undeclared identifier 'hisivar'; did you mean 'his_ivar'?}} 52*67e74705SXin Li self->herivar = a; // expected-error{{'B' does not have a member named 'herivar'; did you mean 'her_ivar'?}} 53*67e74705SXin Li self->hisivar = a; // expected-error{{'B' does not have a member named 'hisivar'; did you mean 'his_ivar'?}} 54*67e74705SXin Li self.hisprop = 0; // expected-error{{property 'hisprop' not found on object of type 'B *'; did you mean 'his_prop'?}} 55*67e74705SXin Li self.herprop = 0; // expected-error{{property 'herprop' not found on object of type 'B *'; did you mean 'her_prop'?}} 56*67e74705SXin Li self.s_prop = 0; // expected-error{{property 's_prop' not found on object of type 'B *'; did you mean 'sprop'?}} 57*67e74705SXin Li} 58*67e74705SXin Li 59*67e74705SXin Li+(void)class_method1 { 60*67e74705SXin Li} 61*67e74705SXin Li@end 62*67e74705SXin Li 63*67e74705SXin Livoid test_message_send(B* b) { 64*67e74705SXin Li [NSstring method:17]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}} 65*67e74705SXin Li} 66*67e74705SXin Li 67*67e74705SXin Li@interface Collide // expected-note{{'Collide' declared here}} 68*67e74705SXin Li{ 69*67e74705SXin Li@public 70*67e74705SXin Li int value; // expected-note{{'value' declared here}} 71*67e74705SXin Li} 72*67e74705SXin Li 73*67e74705SXin Li@property int value; // expected-note{{'value' declared here}} 74*67e74705SXin Li@end 75*67e74705SXin Li 76*67e74705SXin Li@implementation Collide 77*67e74705SXin Li@synthesize value = value; 78*67e74705SXin Li@end 79*67e74705SXin Li 80*67e74705SXin Livoid test2(Collide *a) { 81*67e74705SXin Li a.valu = 17; // expected-error{{property 'valu' not found on object of type 'Collide *'; did you mean 'value'?}} 82*67e74705SXin Li a->vale = 17; // expected-error{{'Collide' does not have a member named 'vale'; did you mean 'value'?}} 83*67e74705SXin Li} 84*67e74705SXin Li 85*67e74705SXin Li#ifdef NON_FIXITS 86*67e74705SXin Li@interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}} 87*67e74705SXin Li@end 88*67e74705SXin Li#endif 89*67e74705SXin Li 90*67e74705SXin Li#ifdef NON_FIXITS 91*67e74705SXin Li@protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}} 92*67e74705SXin Li- (int)send:(void*)buffer bytes:(int)bytes; 93*67e74705SXin Li@end 94*67e74705SXin Li 95*67e74705SXin Li@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}} 96*67e74705SXin Li@end 97*67e74705SXin Li#endif 98*67e74705SXin Li 99*67e74705SXin Li@interface Super 100*67e74705SXin Li- (int)method; // expected-note{{using}} 101*67e74705SXin Li- (int)method2; 102*67e74705SXin Li- (int)method3:(id)x; 103*67e74705SXin Li@end 104*67e74705SXin Li 105*67e74705SXin Li@interface Sub : Super 106*67e74705SXin Li- (int)method; // expected-note{{also found}} 107*67e74705SXin Li@end 108*67e74705SXin Li 109*67e74705SXin Li@implementation Sub 110*67e74705SXin Li- (int)method { 111*67e74705SXin Li return [supper method]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}} 112*67e74705SXin Li} 113*67e74705SXin Li 114*67e74705SXin Li@end 115*67e74705SXin Li 116*67e74705SXin Li@interface Sub2 : Super 117*67e74705SXin Li- (int)method2; 118*67e74705SXin Li@end 119*67e74705SXin Li 120*67e74705SXin Li@implementation Sub2 121*67e74705SXin Li- (int)method2 { 122*67e74705SXin Li return [supper method2]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}} 123*67e74705SXin Li} 124*67e74705SXin Li@end 125*67e74705SXin Li 126*67e74705SXin Li@interface Ivar 127*67e74705SXin Li@end 128*67e74705SXin Li 129*67e74705SXin Li@protocol Proto 130*67e74705SXin Li@property (retain) id ivar; 131*67e74705SXin Li@end 132*67e74705SXin Li 133*67e74705SXin Li#ifdef NON_FIXITS 134*67e74705SXin Li@interface User <Proto> 135*67e74705SXin Li- (void)method; // expected-note{{also found}} 136*67e74705SXin Li@end 137*67e74705SXin Li 138*67e74705SXin Li@implementation User 139*67e74705SXin Li@synthesize ivar; 140*67e74705SXin Li 141*67e74705SXin Li- (void)method { 142*67e74705SXin Li // Test that we don't correct 'ivar' to 'Ivar' e 143*67e74705SXin Li [ivar method]; // expected-warning{{multiple methods named 'method' found}} 144*67e74705SXin Li} 145*67e74705SXin Li@end 146*67e74705SXin Li#endif 147*67e74705SXin Li 148*67e74705SXin Livoid f(A *a) { 149*67e74705SXin Li f(a) // expected-error{{expected ';' after expression}} 150*67e74705SXin Li [a methodA] // expected-error{{expected ';' after expression}} 151*67e74705SXin Li [A methodA] // expected-error{{expected ';' after expression}} 152*67e74705SXin Li} 153*67e74705SXin Li 154*67e74705SXin Li#ifdef NON_FIXITS 155*67e74705SXin Li@interface Sub3 : Super 156*67e74705SXin Li- (int)method3; 157*67e74705SXin Li@end 158*67e74705SXin Li 159*67e74705SXin Li@implementation Sub3 160*67e74705SXin Li- (int)method3 { 161*67e74705SXin Li int x = super; // expected-error{{use of undeclared identifier 'super'}} 162*67e74705SXin Li return 0; 163*67e74705SXin Li} 164*67e74705SXin Li@end 165*67e74705SXin Li#endif 166