Rafael Espindola | 14f9889 | 2013-09-27 20:21:48 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -disable-objc-default-synthesize-properties %s |
Fariborz Jahanian | 24fce28 | 2010-11-09 02:16:57 +0000 | [diff] [blame] | 2 | // rdar://7884086 |
Fariborz Jahanian | 738698d | 2010-05-03 15:49:20 +0000 | [diff] [blame] | 3 | |
| 4 | @interface NSObject @end |
| 5 | |
| 6 | @protocol TopProtocol |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 7 | @property (readonly) id myString; // expected-note {{property}} |
Fariborz Jahanian | 738698d | 2010-05-03 15:49:20 +0000 | [diff] [blame] | 8 | @end |
| 9 | |
| 10 | @protocol SubProtocol <TopProtocol> |
| 11 | @end |
| 12 | |
| 13 | @interface TopClass : NSObject <TopProtocol> {} |
| 14 | @end |
| 15 | |
| 16 | @interface SubClass : TopClass <SubProtocol> {} |
| 17 | @end |
| 18 | |
| 19 | @interface SubClass1 : TopClass {} |
| 20 | @end |
| 21 | |
| 22 | @implementation SubClass1 @end // Test1 - No Warning |
| 23 | |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 24 | @implementation TopClass // expected-warning {{property 'myString' requires method 'myString' to be defined}} |
Fariborz Jahanian | 738698d | 2010-05-03 15:49:20 +0000 | [diff] [blame] | 25 | @end |
| 26 | |
| 27 | @implementation SubClass // Test3 - No Warning |
| 28 | @end |
| 29 | |
| 30 | @interface SubClass2 : TopClass<TopProtocol> |
| 31 | @end |
| 32 | |
| 33 | @implementation SubClass2 @end // Test 4 - No Warning |
| 34 | |
| 35 | @interface SubClass3 : TopClass<SubProtocol> @end |
| 36 | @implementation SubClass3 @end // Test 5 - No Warning |
| 37 | |
| 38 | @interface SubClass4 : SubClass3 @end |
| 39 | @implementation SubClass4 @end // Test 5 - No Warning |
| 40 | |
| 41 | @protocol NewProtocol |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 42 | @property (readonly) id myNewString; // expected-note {{property}} |
Fariborz Jahanian | 738698d | 2010-05-03 15:49:20 +0000 | [diff] [blame] | 43 | @end |
| 44 | |
| 45 | @interface SubClass5 : SubClass4 <NewProtocol> @end |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 46 | @implementation SubClass5 @end // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}} |
Fariborz Jahanian | 738698d | 2010-05-03 15:49:20 +0000 | [diff] [blame] | 47 | |
Fariborz Jahanian | cfa6a27 | 2010-06-29 18:12:32 +0000 | [diff] [blame] | 48 | |
| 49 | // Radar 8035776 |
| 50 | @protocol SuperProtocol |
| 51 | @end |
| 52 | |
| 53 | @interface Super <SuperProtocol> |
| 54 | @end |
| 55 | |
| 56 | @protocol ProtocolWithProperty <SuperProtocol> |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 57 | @property (readonly, assign) id invalidationBacktrace; // expected-note {{property}} |
Fariborz Jahanian | cfa6a27 | 2010-06-29 18:12:32 +0000 | [diff] [blame] | 58 | @end |
| 59 | |
| 60 | @interface INTF : Super <ProtocolWithProperty> |
| 61 | @end |
| 62 | |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 63 | @implementation INTF @end // expected-warning{{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}} |