Douglas Gregor | d203a16 | 2010-01-01 00:15:04 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 2 | // FIXME: the test below isn't testing quite what we want... |
Douglas Gregor | 736fc1b | 2010-01-01 17:23:17 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -fsyntax-only -fixit -o - %s | %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c - |
Douglas Gregor | d203a16 | 2010-01-01 00:15:04 +0000 | [diff] [blame] | 4 | |
| 5 | @interface NSString |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 6 | + (int)method:(int)x; |
Douglas Gregor | d203a16 | 2010-01-01 00:15:04 +0000 | [diff] [blame] | 7 | @end |
| 8 | |
| 9 | void test() { |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 10 | // FIXME: not providing fix-its |
Douglas Gregor | d203a16 | 2010-01-01 00:15:04 +0000 | [diff] [blame] | 11 | NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}} |
| 12 | } |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 13 | |
| 14 | @protocol P1 |
Fariborz Jahanian | 3ac1eda | 2010-01-20 01:51:55 +0000 | [diff] [blame] | 15 | @optional |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 16 | @property int *sprop; // expected-note{{'sprop' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 17 | @end |
| 18 | |
| 19 | @interface A |
| 20 | { |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 21 | int his_ivar; // expected-note 2{{'his_ivar' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 22 | float wibble; |
| 23 | } |
| 24 | |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 25 | @property int his_prop; // expected-note{{'his_prop' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 26 | @end |
| 27 | |
| 28 | @interface B : A <P1> |
| 29 | { |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 30 | int her_ivar; // expected-note 2{{'her_ivar' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 33 | @property int her_prop; // expected-note{{'her_prop' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 34 | - (void)inst_method1:(int)a; |
| 35 | + (void)class_method1; |
| 36 | @end |
| 37 | |
| 38 | @implementation A |
| 39 | @synthesize his_prop = his_ivar; |
| 40 | @end |
| 41 | |
| 42 | @implementation B |
| 43 | @synthesize her_prop = her_ivar; |
| 44 | |
| 45 | -(void)inst_method1:(int)a { |
| 46 | herivar = a; // expected-error{{use of undeclared identifier 'herivar'; did you mean 'her_ivar'?}} |
| 47 | hisivar = a; // expected-error{{use of undeclared identifier 'hisivar'; did you mean 'his_ivar'?}} |
| 48 | self->herivar = a; // expected-error{{'B' does not have a member named 'herivar'; did you mean 'her_ivar'?}} |
| 49 | self->hisivar = a; // expected-error{{'B' does not have a member named 'hisivar'; did you mean 'his_ivar'?}} |
| 50 | self.hisprop = 0; // expected-error{{property 'hisprop' not found on object of type 'B *'; did you mean 'his_prop'?}} |
| 51 | self.herprop = 0; // expected-error{{property 'herprop' not found on object of type 'B *'; did you mean 'her_prop'?}} |
| 52 | self.s_prop = 0; // expected-error{{property 's_prop' not found on object of type 'B *'; did you mean 'sprop'?}} |
| 53 | } |
| 54 | |
| 55 | +(void)class_method1 { |
| 56 | } |
| 57 | @end |
| 58 | |
| 59 | void test_message_send(B* b) { |
| 60 | // FIXME: Not providing fix-its |
| 61 | [NSstring method:17]; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}} |
| 62 | } |
| 63 | |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 64 | @interface Collide // expected-note{{'Collide' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 65 | { |
| 66 | @public |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 67 | int value; // expected-note{{'value' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 70 | @property int value; // expected-note{{'value' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 71 | @end |
| 72 | |
| 73 | @implementation Collide |
| 74 | @synthesize value = value; |
| 75 | @end |
| 76 | |
| 77 | void test2(Collide *a) { |
| 78 | a.valu = 17; // expected-error{{property 'valu' not found on object of type 'Collide *'; did you mean 'value'?}} |
| 79 | a->vale = 17; // expected-error{{'Collide' does not have a member named 'vale'; did you mean 'value'?}} |
| 80 | } |
| 81 | |
| 82 | @interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}} |
| 83 | @end |
| 84 | |
Douglas Gregor | 67dd1d4 | 2010-01-07 00:17:44 +0000 | [diff] [blame] | 85 | @protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 86 | - (int)send:(void*)buffer bytes:(int)bytes; |
| 87 | @end |
| 88 | |
Douglas Gregor | 6202119 | 2010-02-04 23:42:48 +0000 | [diff] [blame] | 89 | @interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}} |
Douglas Gregor | f06cdae | 2010-01-03 18:01:57 +0000 | [diff] [blame] | 90 | @end |