1 // RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s
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;
11 @implementation Inteface_Implementation
12 - (int)normal_normal {
15 - (int)direct_normal {
18 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}}
21 - (int)direct_direct __attribute__((objc_direct)) {
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;
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;
41 @implementation Inteface_Extension
44 __attribute__((objc_root_class))
45 @interface Extension_Implementation
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;
55 @implementation Extension_Implementation
56 - (int)normal_normal {
59 - (int)direct_normal {
62 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}}
65 - (int)direct_direct __attribute__((objc_direct)) {
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}}
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'}}
85 @implementation Inteface_Category
88 __attribute__((objc_root_class))
89 @interface Extension_Category
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}}
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'}}
106 @implementation Extension_Category
109 __attribute__((objc_root_class))
110 @interface Implementation_Category
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}}
120 @implementation Implementation_Category
121 - (int)normal_normal {
124 - (int)direct_normal { // expected-error {{direct method was declared in a category but is implemented in the primary interface}}
127 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in the primary interface}}
130 - (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in the primary interface}}
135 __attribute__((objc_root_class))
136 @interface Category_Category
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}}
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'}}
153 @implementation Category_Category
156 __attribute__((objc_root_class))
157 @interface Category_CategoryImplementation
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;
167 @implementation Category_CategoryImplementation (SomeCategory)
168 - (int)normal_normal {
171 - (int)direct_normal {
174 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}}
177 - (int)direct_direct __attribute__((objc_direct)) {
182 @implementation Category_CategoryImplementation
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}}
193 @interface Interface_CategoryImplementation (SomeCategory)
196 @implementation Interface_CategoryImplementation (SomeCategory)
197 - (int)normal_normal {
200 - (int)direct_normal { // expected-error {{direct method was declared in the primary interface but is implemented in a category}}
203 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in the primary interface but is implemented in a category}}
206 - (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in the primary interface but is implemented in a category}}
211 @implementation Interface_CategoryImplementation
214 __attribute__((objc_root_class))
215 @interface Extension_CategoryImplementation
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}}
225 @interface Extension_CategoryImplementation (SomeCategory)
228 @implementation Extension_CategoryImplementation (SomeCategory)
229 - (int)normal_normal {
232 - (int)direct_normal { // expected-error {{direct method was declared in an extension but is implemented in a different category}}
235 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in an extension but is implemented in a different category}}
238 - (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in an extension but is implemented in a different category}}
243 __attribute__((objc_root_class))
244 @interface OtherCategory_CategoryImplementation
247 @interface OtherCategory_CategoryImplementation (SomeCategory)
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}}
257 @implementation OtherCategory_CategoryImplementation (SomeCategory)
258 - (int)normal_normal {
261 - (int)direct_normal { // expected-error {{direct method was declared in a category but is implemented in a different category}}
264 - (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in a different category}}
267 - (int)direct_direct __attribute__((objc_direct)) { // expected-error {{direct method was declared in a category but is implemented in a different category}}
272 @implementation OtherCategory_CategoryImplementation