1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -DNON_FIXITS -verify -Wno-objc-root-class %s
3 // RUN: not %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fixit -Wno-objc-root-class %t
4 // RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -pedantic -Werror -Wno-objc-root-class %t
5 // RUN: grep "@implementation Sub3" %t
7 @interface NSString // expected-note 2{{'NSString' declared here}}
12 NSstring *str = @"A string"; // expected-error{{unknown type name 'NSstring'; did you mean 'NSString'?}}
17 @property int *sprop; // expected-note{{'sprop' declared here}}
22 int his_ivar; // expected-note 2{{'his_ivar' declared here}}
27 @property int his_prop; // expected-note{{'his_prop' declared here}}
32 int her_ivar; // expected-note 2{{'her_ivar' declared here}}
35 @property int her_prop; // expected-note{{'her_prop' declared here}}
36 - (void)inst_method1:(int)a;
37 + (void)class_method1;
41 @synthesize his_prop = his_ivar;
47 @synthesize her_prop = her_ivar;
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'?}}
59 +(void)class_method1 {
63 void test_message_send(B* b) {
64 [NSstring method:17]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
67 @interface Collide // expected-note{{'Collide' declared here}}
70 int value; // expected-note{{'value' declared here}}
73 @property int value; // expected-note{{'value' declared here}}
76 @implementation Collide
77 @synthesize value = value;
80 void 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'?}}
86 @interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}}
91 @protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}}
92 - (int)send:(void*)buffer bytes:(int)bytes;
95 @interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}}
100 - (int)method; // expected-note{{using}}
102 - (int)method3:(id)x;
105 @interface Sub : Super
106 - (int)method; // expected-note{{also found}}
111 return [supper method]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}
116 @interface Sub2 : Super
122 return [supper method2]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}
130 @property (retain) id ivar;
134 @interface User <Proto>
135 - (void)method; // expected-note{{also found}}
142 // Test that we don't correct 'ivar' to 'Ivar' e
143 [ivar method]; // expected-warning{{multiple methods named 'method' found}}
149 f(a) // expected-error{{expected ';' after expression}}
150 [a methodA] // expected-error{{expected ';' after expression}}
151 [A methodA] // expected-error{{expected ';' after expression}}
155 @interface Sub3 : Super
161 int x = super; // expected-error{{use of undeclared identifier 'super'}}