274 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s2 3__attribute__((objc_root_class))4@interface Inteface_Implementation5@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@end10 11@implementation Inteface_Implementation12- (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@end25 26__attribute__((objc_root_class))27@interface Inteface_Extension28@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@end33 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@end40 41@implementation Inteface_Extension42@end43 44__attribute__((objc_root_class))45@interface Extension_Implementation46@end47 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@end54 55@implementation Extension_Implementation56- (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@end69 70__attribute__((objc_root_class))71@interface Inteface_Category72@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@end77 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@end84 85@implementation Inteface_Category86@end87 88__attribute__((objc_root_class))89@interface Extension_Category90@end91 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@end98 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@end105 106@implementation Extension_Category107@end108 109__attribute__((objc_root_class))110@interface Implementation_Category111@end112 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@end119 120@implementation Implementation_Category121- (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@end134 135__attribute__((objc_root_class))136@interface Category_Category137@end138 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@end145 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@end152 153@implementation Category_Category154@end155 156__attribute__((objc_root_class))157@interface Category_CategoryImplementation158@end159 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@end166 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@end181 182@implementation Category_CategoryImplementation183@end184 185__attribute__((objc_root_class))186@interface Interface_CategoryImplementation187@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@end192 193@interface Interface_CategoryImplementation (SomeCategory)194@end195 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@end210 211@implementation Interface_CategoryImplementation212@end213 214__attribute__((objc_root_class))215@interface Extension_CategoryImplementation216@end217 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@end224 225@interface Extension_CategoryImplementation (SomeCategory)226@end227 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@end242 243__attribute__((objc_root_class))244@interface OtherCategory_CategoryImplementation245@end246 247@interface OtherCategory_CategoryImplementation (SomeCategory)248@end249 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@end256 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@end271 272@implementation OtherCategory_CategoryImplementation273@end274