Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | a8ef2ec | 2008-12-05 18:38:31 +0000 | [diff] [blame] | 2 | |
| 3 | @interface A |
Anders Carlsson | d1aa800 | 2010-04-23 02:20:12 +0000 | [diff] [blame] | 4 | -(float) x; // expected-note {{declared here}} |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 5 | @property int x; // expected-warning {{type of property 'x' does not match type of accessor 'x'}} |
Fariborz Jahanian | a8ef2ec | 2008-12-05 18:38:31 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | @interface A (Cat) |
| 9 | @property int moo; // expected-note {{previous definition is here}} |
| 10 | @end |
| 11 | |
| 12 | @implementation A (Cat) |
| 13 | -(int) moo { |
| 14 | return 0; |
| 15 | } |
Chris Lattner | 3aff919 | 2009-04-11 19:58:42 +0000 | [diff] [blame] | 16 | -(void) setMoo: (float) x { // expected-warning {{conflicting parameter types in implementation of 'setMoo:': 'int' vs 'float'}} |
Fariborz Jahanian | a8ef2ec | 2008-12-05 18:38:31 +0000 | [diff] [blame] | 17 | } |
| 18 | @end |
| 19 | |
Fariborz Jahanian | 0b65b1d | 2008-12-17 17:55:55 +0000 | [diff] [blame] | 20 | |
| 21 | typedef int T[2]; |
| 22 | typedef void (F)(void); |
| 23 | |
| 24 | @interface C |
| 25 | @property(assign) T p2; // expected-error {{property cannot have array or function type 'T'}} |
| 26 | |
| 27 | @property(assign) F f2; // expected-error {{property cannot have array or function type 'F'}} |
| 28 | |
| 29 | @end |
| 30 | |
| 31 | |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 32 | @class SSyncSet; |
| 33 | |
| 34 | @interface SPeer |
| 35 | @property(nonatomic,readonly,retain) SSyncSet* syncSet; |
| 36 | @end |
| 37 | |
| 38 | @class SSyncSet_iDisk; |
| 39 | |
| 40 | @interface SPeer_iDisk_remote1 : SPeer |
Anders Carlsson | d1aa800 | 2010-04-23 02:20:12 +0000 | [diff] [blame] | 41 | - (SSyncSet_iDisk*) syncSet; // expected-note {{declared here}} |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 42 | @end |
| 43 | |
| 44 | @interface SPeer_iDisk_local |
| 45 | - (SSyncSet_iDisk*) syncSet; |
| 46 | @end |
| 47 | |
| 48 | @interface SSyncSet |
| 49 | @end |
| 50 | |
| 51 | @interface SSyncSet_iDisk |
| 52 | @property(nonatomic,readonly,retain) SPeer_iDisk_local* localPeer; |
| 53 | @end |
| 54 | |
| 55 | @interface SPeer_iDisk_remote1 (protected) |
| 56 | @end |
| 57 | |
| 58 | @implementation SPeer_iDisk_remote1 (protected) |
| 59 | - (id) preferredSource1 |
| 60 | { |
| 61 | return self.syncSet.localPeer; // expected-warning {{type of property 'syncSet' does not match type of accessor 'syncSet'}} |
| 62 | } |
| 63 | @end |
| 64 | |
| 65 | @interface NSArray @end |
| 66 | |
| 67 | @interface NSMutableArray : NSArray |
| 68 | @end |
| 69 | |
| 70 | @interface Class1 |
| 71 | { |
| 72 | NSMutableArray* pieces; |
| 73 | NSArray* first; |
| 74 | } |
| 75 | |
Fariborz Jahanian | 7aaa409 | 2009-05-08 21:10:00 +0000 | [diff] [blame] | 76 | @property (readonly) NSArray* pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}} |
| 77 | @property (readonly) NSMutableArray* first; |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 78 | |
Anders Carlsson | d1aa800 | 2010-04-23 02:20:12 +0000 | [diff] [blame] | 79 | - (NSMutableArray*) pieces; // expected-note {{declared here}} // expected-note {{declared here}} |
Fariborz Jahanian | 7aaa409 | 2009-05-08 21:10:00 +0000 | [diff] [blame] | 80 | - (NSArray*) first; |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 81 | @end |
| 82 | |
| 83 | @interface Class2 { |
| 84 | Class1* container; |
| 85 | } |
| 86 | |
| 87 | @end |
| 88 | |
| 89 | @implementation Class2 |
| 90 | |
| 91 | - (id) lastPiece |
| 92 | { |
Fariborz Jahanian | 7aaa409 | 2009-05-08 21:10:00 +0000 | [diff] [blame] | 93 | return container.pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}} |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | - (id)firstPeice |
| 97 | { |
Fariborz Jahanian | 7aaa409 | 2009-05-08 21:10:00 +0000 | [diff] [blame] | 98 | return container.first; |
Fariborz Jahanian | 4c2743f | 2009-05-08 19:36:34 +0000 | [diff] [blame] | 99 | } |
| 100 | @end |
| 101 | |