166 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -DNON_FIXITS -verify -Wno-objc-root-class %s2// RUN: cp %s %t3// RUN: not %clang_cc1 -x objective-c -triple x86_64-apple-darwin10 -fixit -Wno-objc-root-class %t4// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -pedantic -Werror -Wno-objc-root-class %t5// RUN: grep "@implementation Sub3" %t6 7@interface NSString // expected-note 2{{'NSString' declared here}}8+ (int)method:(int)x;9@end10 11void test(void) {12 NSstring *str = @"A string"; // expected-error{{unknown type name 'NSstring'; did you mean 'NSString'?}}13}14 15@protocol P116@optional17@property int *sprop; // expected-note{{'sprop' declared here}}18@end19 20@interface A21{22 int his_ivar; // expected-note 2{{'his_ivar' declared here}}23 float wibble;24}25- (void)methodA;26+ (void)methodA;27@property int his_prop; // expected-note{{'his_prop' declared here}}28@end29 30@interface B : A <P1>31{32 int her_ivar; // expected-note 2{{'her_ivar' declared here}}33}34 35@property int her_prop; // expected-note{{'her_prop' declared here}}36- (void)inst_method1:(int)a;37+ (void)class_method1;38@end39 40@implementation A41@synthesize his_prop = his_ivar;42- (void)methodA { }43+ (void)methodA { }44@end45 46@implementation B47@synthesize her_prop = her_ivar;48 49-(void)inst_method1:(int)a {50 herivar = a; // expected-error{{use of undeclared identifier 'herivar'; did you mean 'her_ivar'?}}51 hisivar = a; // expected-error{{use of undeclared identifier 'hisivar'; did you mean 'his_ivar'?}}52 self->herivar = a; // expected-error{{'B' does not have a member named 'herivar'; did you mean 'her_ivar'?}}53 self->hisivar = a; // expected-error{{'B' does not have a member named 'hisivar'; did you mean 'his_ivar'?}}54 self.hisprop = 0; // expected-error{{property 'hisprop' not found on object of type 'B *'; did you mean 'his_prop'?}}55 self.herprop = 0; // expected-error{{property 'herprop' not found on object of type 'B *'; did you mean 'her_prop'?}}56 self.s_prop = 0; // expected-error{{property 's_prop' not found on object of type 'B *'; did you mean 'sprop'?}}57}58 59+(void)class_method1 {60}61@end62 63void test_message_send(B* b) {64 [NSstring method:17]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}65}66 67@interface Collide // expected-note{{'Collide' declared here}}68{69@public70 int value; // expected-note{{'value' declared here}}71}72 73@property int value; // expected-note{{'value' declared here}}74@end75 76@implementation Collide77@synthesize value = value;78@end79 80void test2(Collide *a) {81 a.valu = 17; // expected-error{{property 'valu' not found on object of type 'Collide *'; did you mean 'value'?}}82 a->vale = 17; // expected-error{{'Collide' does not have a member named 'vale'; did you mean 'value'?}}83}84 85#ifdef NON_FIXITS86@interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}}87@end88#endif89 90#ifdef NON_FIXITS91@protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}}92- (int)send:(void*)buffer bytes:(int)bytes;93@end94 95@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}}96@end97#endif98 99@interface Super100- (int)method; // expected-note{{using}}101- (int)method2;102- (int)method3:(id)x;103@end104 105@interface Sub : Super106- (int)method; // expected-note{{also found}}107@end108 109@implementation Sub110- (int)method {111 return [supper method]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}112}113 114@end115 116@interface Sub2 : Super117- (int)method2;118@end119 120@implementation Sub2121- (int)method2 {122 return [supper method2]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}123}124@end125 126@interface Ivar127@end128 129@protocol Proto130@property (retain) id ivar;131@end132 133#ifdef NON_FIXITS134@interface User <Proto>135- (void)method; // expected-note{{also found}}136@end137 138@implementation User139@synthesize ivar;140 141- (void)method {142 // Test that we don't correct 'ivar' to 'Ivar' e143 [ivar method]; // expected-warning{{multiple methods named 'method' found}}144}145@end146#endif147 148void f(A *a) {149 f(a) // expected-error{{expected ';' after expression}}150 [a methodA] // expected-error{{expected ';' after expression}}151 [A methodA] // expected-error{{expected ';' after expression}}152}153 154#ifdef NON_FIXITS155@interface Sub3 : Super156- (int)method3;157@end158 159@implementation Sub3160- (int)method3 {161 int x = super; // expected-error{{use of undeclared identifier 'super'}}162 return 0;163}164@end165#endif166