| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s |
| 2 |
|
| 3 |
__attribute__((objc_root_class)) |
| 4 |
@interface Inteface_Implementation |
| 5 |
@property(nonatomic, readonly) int normal_normal; |
| 6 |
@property(nonatomic, readonly, direct) int direct_normal; |
| 7 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 8 |
@property(nonatomic, readonly, direct) int direct_direct; |
| 9 |
@end |
| 10 |
|
| 11 |
@implementation Inteface_Implementation |
| 12 |
- (int)normal_normal { |
| 13 |
return 42; |
| 14 |
} |
| 15 |
- (int)direct_normal { |
| 16 |
return 42; |
| 17 |
} |
| 18 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}} |
| 19 |
return 42; |
| 20 |
} |
| 21 |
- (int)direct_direct __attribute__((objc_direct)) { |
| 22 |
return 42; |
| 23 |
} |
| 24 |
@end |
| 25 |
|
| 26 |
__attribute__((objc_root_class)) |
| 27 |
@interface Inteface_Extension |
| 28 |
@property(nonatomic, readonly) int normal_normal; |
| 29 |
@property(nonatomic, readonly, direct) int direct_normal; |
| 30 |
@property(nonatomic, readonly) int normal_direct; |
| 31 |
@property(nonatomic, readonly, direct) int direct_direct; |
| 32 |
@end |
| 33 |
|
| 34 |
@interface Inteface_Extension () |
| 35 |
@property(nonatomic, readwrite) int normal_normal; |
| 36 |
@property(nonatomic, readwrite) int direct_normal; |
| 37 |
@property(nonatomic, readwrite, direct) int normal_direct; |
| 38 |
@property(nonatomic, readwrite, direct) int direct_direct; |
| 39 |
@end |
| 40 |
|
| 41 |
@implementation Inteface_Extension |
| 42 |
@end |
| 43 |
|
| 44 |
__attribute__((objc_root_class)) |
| 45 |
@interface Extension_Implementation |
| 46 |
@end |
| 47 |
|
| 48 |
@interface Extension_Implementation () |
| 49 |
@property(nonatomic, readwrite) int normal_normal; |
| 50 |
@property(nonatomic, readwrite, direct) int direct_normal; |
| 51 |
@property(nonatomic, readwrite) int normal_direct; // expected-note {{previous declaration is here}} |
| 52 |
@property(nonatomic, readwrite, direct) int direct_direct; |
| 53 |
@end |
| 54 |
|
| 55 |
@implementation Extension_Implementation |
| 56 |
- (int)normal_normal { |
| 57 |
return 42; |
| 58 |
} |
| 59 |
- (int)direct_normal { |
| 60 |
return 42; |
| 61 |
} |
| 62 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}} |
| 63 |
return 42; |
| 64 |
} |
| 65 |
- (int)direct_direct __attribute__((objc_direct)) { |
| 66 |
return 42; |
| 67 |
} |
| 68 |
@end |
| 69 |
|
| 70 |
__attribute__((objc_root_class)) |
| 71 |
@interface Inteface_Category |
| 72 |
@property(nonatomic, readonly) int normal_normal; |
| 73 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 74 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 75 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 76 |
@end |
| 77 |
|
| 78 |
@interface Inteface_Category (SomeCategory) |
| 79 |
@property(nonatomic, readonly) int normal_normal; |
| 80 |
@property(nonatomic, readonly) int direct_normal; // expected-error {{property declaration conflicts with previous direct declaration of property 'direct_normal'}} |
| 81 |
@property(nonatomic, readonly, direct) int normal_direct; // expected-error {{direct property declaration conflicts with previous declaration of property 'normal_direct'}} |
| 82 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-error {{direct property declaration conflicts with previous direct declaration of property 'direct_direct'}} |
| 83 |
@end |
| 84 |
|
| 85 |
@implementation Inteface_Category |
| 86 |
@end |
| 87 |
|
| 88 |
__attribute__((objc_root_class)) |
| 89 |
@interface Extension_Category |
| 90 |
@end |
| 91 |
|
| 92 |
@interface Extension_Category () |
| 93 |
@property(nonatomic, readonly) int normal_normal; |
| 94 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 95 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 96 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 97 |
@end |
| 98 |
|
| 99 |
@interface Extension_Category (SomeCategory) |
| 100 |
@property(nonatomic, readonly) int normal_normal; |
| 101 |
@property(nonatomic, readonly) int direct_normal; // expected-error {{property declaration conflicts with previous direct declaration of property 'direct_normal'}} |
| 102 |
@property(nonatomic, readonly, direct) int normal_direct; // expected-error {{direct property declaration conflicts with previous declaration of property 'normal_direct'}} |
| 103 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-error {{direct property declaration conflicts with previous direct declaration of property 'direct_direct'}} |
| 104 |
@end |
| 105 |
|
| 106 |
@implementation Extension_Category |
| 107 |
@end |
| 108 |
|
| 109 |
__attribute__((objc_root_class)) |
| 110 |
@interface Implementation_Category |
| 111 |
@end |
| 112 |
|
| 113 |
@interface Implementation_Category (SomeCategory) |
| 114 |
@property(nonatomic, readonly) int normal_normal; |
| 115 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 116 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 117 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 118 |
@end |
| 119 |
|
| 120 |
@implementation Implementation_Category |
| 121 |
- (int)normal_normal { |
| 122 |
return 42; |
| 123 |
} |
| 124 |
- (int)direct_normal { // expected-error {{direct method was declared in a category but is implemented in the primary interface}} |
| 125 |
return 42; |
| 126 |
} |
| 127 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in the primary interface}} |
| 128 |
return 42; |
| 129 |
} |
| 130 |
- (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in the primary interface}} |
| 131 |
return 42; |
| 132 |
} |
| 133 |
@end |
| 134 |
|
| 135 |
__attribute__((objc_root_class)) |
| 136 |
@interface Category_Category |
| 137 |
@end |
| 138 |
|
| 139 |
@interface Category_Category (SomeCategory) |
| 140 |
@property(nonatomic, readonly) int normal_normal; |
| 141 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 142 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 143 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 144 |
@end |
| 145 |
|
| 146 |
@interface Category_Category (SomeOtherCategory) |
| 147 |
@property(nonatomic, readonly) int normal_normal; |
| 148 |
@property(nonatomic, readonly) int direct_normal; // expected-error {{property declaration conflicts with previous direct declaration of property 'direct_normal'}} |
| 149 |
@property(nonatomic, readonly, direct) int normal_direct; // expected-error {{direct property declaration conflicts with previous declaration of property 'normal_direct'}} |
| 150 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-error {{direct property declaration conflicts with previous direct declaration of property 'direct_direct'}} |
| 151 |
@end |
| 152 |
|
| 153 |
@implementation Category_Category |
| 154 |
@end |
| 155 |
|
| 156 |
__attribute__((objc_root_class)) |
| 157 |
@interface Category_CategoryImplementation |
| 158 |
@end |
| 159 |
|
| 160 |
@interface Category_CategoryImplementation (SomeCategory) |
| 161 |
@property(nonatomic, readonly) int normal_normal; |
| 162 |
@property(nonatomic, readonly, direct) int direct_normal; |
| 163 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 164 |
@property(nonatomic, readonly, direct) int direct_direct; |
| 165 |
@end |
| 166 |
|
| 167 |
@implementation Category_CategoryImplementation (SomeCategory) |
| 168 |
- (int)normal_normal { |
| 169 |
return 42; |
| 170 |
} |
| 171 |
- (int)direct_normal { |
| 172 |
return 42; |
| 173 |
} |
| 174 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}} |
| 175 |
return 42; |
| 176 |
} |
| 177 |
- (int)direct_direct __attribute__((objc_direct)) { |
| 178 |
return 42; |
| 179 |
} |
| 180 |
@end |
| 181 |
|
| 182 |
@implementation Category_CategoryImplementation |
| 183 |
@end |
| 184 |
|
| 185 |
__attribute__((objc_root_class)) |
| 186 |
@interface Interface_CategoryImplementation |
| 187 |
@property(nonatomic, readonly) int normal_normal; |
| 188 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 189 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 190 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 191 |
@end |
| 192 |
|
| 193 |
@interface Interface_CategoryImplementation (SomeCategory) |
| 194 |
@end |
| 195 |
|
| 196 |
@implementation Interface_CategoryImplementation (SomeCategory) |
| 197 |
- (int)normal_normal { |
| 198 |
return 42; |
| 199 |
} |
| 200 |
- (int)direct_normal { // expected-error {{direct method was declared in the primary interface but is implemented in a category}} |
| 201 |
return 42; |
| 202 |
} |
| 203 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in the primary interface but is implemented in a category}} |
| 204 |
return 42; |
| 205 |
} |
| 206 |
- (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in the primary interface but is implemented in a category}} |
| 207 |
return 42; |
| 208 |
} |
| 209 |
@end |
| 210 |
|
| 211 |
@implementation Interface_CategoryImplementation |
| 212 |
@end |
| 213 |
|
| 214 |
__attribute__((objc_root_class)) |
| 215 |
@interface Extension_CategoryImplementation |
| 216 |
@end |
| 217 |
|
| 218 |
@interface Extension_CategoryImplementation () |
| 219 |
@property(nonatomic, readonly) int normal_normal; |
| 220 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 221 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 222 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 223 |
@end |
| 224 |
|
| 225 |
@interface Extension_CategoryImplementation (SomeCategory) |
| 226 |
@end |
| 227 |
|
| 228 |
@implementation Extension_CategoryImplementation (SomeCategory) |
| 229 |
- (int)normal_normal { |
| 230 |
return 42; |
| 231 |
} |
| 232 |
- (int)direct_normal { // expected-error {{direct method was declared in an extension but is implemented in a different category}} |
| 233 |
return 42; |
| 234 |
} |
| 235 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in an extension but is implemented in a different category}} |
| 236 |
return 42; |
| 237 |
} |
| 238 |
- (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in an extension but is implemented in a different category}} |
| 239 |
return 42; |
| 240 |
} |
| 241 |
@end |
| 242 |
|
| 243 |
__attribute__((objc_root_class)) |
| 244 |
@interface OtherCategory_CategoryImplementation |
| 245 |
@end |
| 246 |
|
| 247 |
@interface OtherCategory_CategoryImplementation (SomeCategory) |
| 248 |
@end |
| 249 |
|
| 250 |
@interface OtherCategory_CategoryImplementation (SomeOtherCategory) |
| 251 |
@property(nonatomic, readonly) int normal_normal; |
| 252 |
@property(nonatomic, readonly, direct) int direct_normal; // expected-note {{previous declaration is here}} |
| 253 |
@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}} |
| 254 |
@property(nonatomic, readonly, direct) int direct_direct; // expected-note {{previous declaration is here}} |
| 255 |
@end |
| 256 |
|
| 257 |
@implementation OtherCategory_CategoryImplementation (SomeCategory) |
| 258 |
- (int)normal_normal { |
| 259 |
return 42; |
| 260 |
} |
| 261 |
- (int)direct_normal { // expected-error {{direct method was declared in a category but is implemented in a different category}} |
| 262 |
return 42; |
| 263 |
} |
| 264 |
- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in a different category}} |
| 265 |
return 42; |
| 266 |
} |
| 267 |
- (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in a different category}} |
| 268 |
return 42; |
| 269 |
} |
| 270 |
@end |
| 271 |
|
| 272 |
@implementation OtherCategory_CategoryImplementation |
| 273 |
@end |