annotate clang/test/SemaObjC/property-ambiguous-synthesis.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
2 // rdar://13075400
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 @protocol FooAsID
anatofuz
parents:
diff changeset
5 @property (assign) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\
anatofuz
parents:
diff changeset
6 // expected-warning {{property of type 'id' was selected for synthesis}}
anatofuz
parents:
diff changeset
7 @end
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 @protocol FooAsDouble
anatofuz
parents:
diff changeset
10 @property double foo; // expected-warning 2 {{property of type 'double' was selected for synthesis}} \
anatofuz
parents:
diff changeset
11 // expected-note {{it could also be property of type 'double' declared here}}
anatofuz
parents:
diff changeset
12 @end
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 @protocol FooAsShort
anatofuz
parents:
diff changeset
15 @property short foo; // expected-note {{it could also be property of type 'short' declared here}}
anatofuz
parents:
diff changeset
16 @end
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 @interface NSObject @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 @interface AnObject : NSObject<FooAsDouble,FooAsID>
anatofuz
parents:
diff changeset
21 @end
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 @interface Sub : AnObject
anatofuz
parents:
diff changeset
24 @end
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 @implementation Sub
anatofuz
parents:
diff changeset
27 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
anatofuz
parents:
diff changeset
28 @end
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 @interface AnotherObject : NSObject<FooAsDouble, FooAsID,FooAsDouble, FooAsID, FooAsDouble,FooAsID>
anatofuz
parents:
diff changeset
32 @end
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 @implementation AnotherObject
anatofuz
parents:
diff changeset
35 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
anatofuz
parents:
diff changeset
36 @end
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 @interface YetAnotherObject : NSObject<FooAsID,FooAsShort, FooAsDouble,FooAsID, FooAsShort>
anatofuz
parents:
diff changeset
40 @end
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 @implementation YetAnotherObject
anatofuz
parents:
diff changeset
43 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
anatofuz
parents:
diff changeset
44 @end
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 double func(YetAnotherObject *object) {
anatofuz
parents:
diff changeset
47 return [object foo]; // expected-error {{returning 'id' from a function with incompatible result type 'double'}}
anatofuz
parents:
diff changeset
48 }