Fariborz Jahanian | af6c314 | 2010-07-17 01:16:59 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s |
| 2 | |
| 3 | @interface NSObject |
| 4 | - (void) release; |
| 5 | - (id) retain; |
| 6 | @end |
| 7 | @class NSString; |
| 8 | |
| 9 | @interface SynthItAll : NSObject |
| 10 | @property int howMany; |
| 11 | @property (retain) NSString* what; |
| 12 | @end |
| 13 | |
| 14 | @implementation SynthItAll |
| 15 | //@synthesize howMany, what; |
| 16 | @end |
| 17 | |
| 18 | |
| 19 | @interface SynthSetter : NSObject |
| 20 | @property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair |
| 21 | @property (nonatomic, retain) NSString* what; |
| 22 | @end |
| 23 | |
| 24 | @implementation SynthSetter |
| 25 | //@synthesize howMany, what; |
| 26 | |
| 27 | - (int) howMany { |
| 28 | return howMany; |
| 29 | } |
| 30 | // - (void) setHowMany: (int) value |
| 31 | |
| 32 | - (NSString*) what { |
| 33 | return what; |
| 34 | } |
| 35 | // - (void) setWhat: (NSString*) value |
| 36 | @end |
| 37 | |
| 38 | |
| 39 | @interface SynthGetter : NSObject |
| 40 | @property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair |
| 41 | @property (nonatomic, retain) NSString* what; |
| 42 | @end |
| 43 | |
| 44 | @implementation SynthGetter |
| 45 | //@synthesize howMany, what; |
| 46 | |
| 47 | // - (int) howMany |
| 48 | - (void) setHowMany: (int) value { |
| 49 | howMany = value; |
| 50 | } |
| 51 | |
| 52 | // - (NSString*) what |
| 53 | - (void) setWhat: (NSString*) value { |
| 54 | if (what != value) { |
| 55 | [what release]; |
| 56 | what = [value retain]; |
| 57 | } |
| 58 | } |
| 59 | @end |
| 60 | |
| 61 | |
| 62 | @interface SynthNone : NSObject |
| 63 | @property int howMany; |
| 64 | @property (retain) NSString* what; |
| 65 | @end |
| 66 | |
| 67 | @implementation SynthNone |
| 68 | //@synthesize howMany, what; // REM: Redundant anyway |
| 69 | |
| 70 | - (int) howMany { |
| 71 | return howMany; |
| 72 | } |
| 73 | - (void) setHowMany: (int) value { |
| 74 | howMany = value; |
| 75 | } |
| 76 | |
| 77 | - (NSString*) what { |
| 78 | return what; |
| 79 | } |
| 80 | - (void) setWhat: (NSString*) value { |
| 81 | if (what != value) { |
| 82 | [what release]; |
| 83 | what = [value retain]; |
| 84 | } |
| 85 | } |
| 86 | @end |
| 87 | |
Fariborz Jahanian | 95f1b86 | 2010-08-25 00:31:58 +0000 | [diff] [blame] | 88 | // rdar://8349319 |
| 89 | // No default synthesis if implementation has getter (readonly) and setter(readwrite) methods. |
| 90 | @interface DSATextSearchResult |
| 91 | @property(assign,readonly) float relevance; |
| 92 | @property(assign,readonly) char isTitleMatch; |
| 93 | @end |
| 94 | |
| 95 | @interface DSANodeSearchResult : DSATextSearchResult {} |
| 96 | @end |
| 97 | |
| 98 | |
| 99 | @implementation DSATextSearchResult |
| 100 | -(char)isTitleMatch { |
| 101 | return (char)0; |
| 102 | } |
| 103 | |
| 104 | -(float)relevance { |
| 105 | return 0.0; |
| 106 | } |
| 107 | @end |
| 108 | |
| 109 | @implementation DSANodeSearchResult |
| 110 | -(id)initWithNode:(id )node relevance:(float)relevance isTitleMatch:(char)isTitleMatch { |
| 111 | relevance = 0.0; |
| 112 | isTitleMatch = 'a'; |
| 113 | return self; |
| 114 | } |
| 115 | @end |
Fariborz Jahanian | af6c314 | 2010-07-17 01:16:59 +0000 | [diff] [blame] | 116 | |