annotate clang/test/SemaObjC/property-inherited.m @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +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 %s -fsyntax-only -verify
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -x objective-c++ %s -fsyntax-only -verify
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // rdar://6497242 Inherited overridden protocol declared objects don't work
anatofuz
parents:
diff changeset
5 // rdar://9740328 Case for c++
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 @protocol NSObject @end
anatofuz
parents:
diff changeset
8 @interface NSObject @end
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 @protocol FooDelegate<NSObject>
anatofuz
parents:
diff changeset
11 @optional
anatofuz
parents:
diff changeset
12 - (void)fooTask;
anatofuz
parents:
diff changeset
13 @end
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 @protocol BarDelegate<NSObject, FooDelegate>
anatofuz
parents:
diff changeset
16 @optional
anatofuz
parents:
diff changeset
17 - (void)barTask;
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 @interface Foo : NSObject {
anatofuz
parents:
diff changeset
21 id _delegate;
anatofuz
parents:
diff changeset
22 }
anatofuz
parents:
diff changeset
23 @property(nonatomic, assign) id<FooDelegate> delegate;
anatofuz
parents:
diff changeset
24 @property(nonatomic, assign) id<BarDelegate> delegate2; // expected-note {{property declared here}}
anatofuz
parents:
diff changeset
25 @end
anatofuz
parents:
diff changeset
26 @interface Bar : Foo {
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 @property(nonatomic, assign) id<BarDelegate> delegate;
anatofuz
parents:
diff changeset
29 @property(nonatomic, assign) id<FooDelegate> delegate2; // expected-warning{{property type 'id<FooDelegate>' is incompatible with type 'id<BarDelegate>' inherited from 'Foo'}}
anatofuz
parents:
diff changeset
30 @end
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 @interface NSData @end
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 @interface NSMutableData : NSData @end
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 @interface Base : NSData
anatofuz
parents:
diff changeset
37 @property(assign) id ref;
anatofuz
parents:
diff changeset
38 @property(assign) Base *p_base;
anatofuz
parents:
diff changeset
39 @property(assign) NSMutableData *p_data; // expected-note {{property declared here}}
anatofuz
parents:
diff changeset
40 @end
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 @interface Data : Base
anatofuz
parents:
diff changeset
43 @property(assign) NSData *ref;
anatofuz
parents:
diff changeset
44 @property(assign) Data *p_base;
anatofuz
parents:
diff changeset
45 @property(assign) NSData *p_data; // expected-warning{{property type 'NSData *' is incompatible with type 'NSMutableData *' inherited from 'Base'}}
anatofuz
parents:
diff changeset
46 @end
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 // rdar://15967517
anatofuz
parents:
diff changeset
49 @protocol P1
anatofuz
parents:
diff changeset
50 @property (nonatomic) void* selected;
anatofuz
parents:
diff changeset
51 @end
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 @protocol P2
anatofuz
parents:
diff changeset
54 @property (nonatomic) void* selected; // expected-note {{property declared here}}
anatofuz
parents:
diff changeset
55 @end
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 @interface MKAnnotationView <P1>
anatofuz
parents:
diff changeset
58 @property (nonatomic) void* selected; // expected-note {{property declared here}}
anatofuz
parents:
diff changeset
59 @property (nonatomic) char selected2;
anatofuz
parents:
diff changeset
60 @end
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 @interface Parent : MKAnnotationView <P2>
anatofuz
parents:
diff changeset
63 @property (nonatomic) void* selected1; // expected-note {{property declared here}}
anatofuz
parents:
diff changeset
64 @property (nonatomic) char selected2;
anatofuz
parents:
diff changeset
65 @end
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67 @interface Child : Parent
anatofuz
parents:
diff changeset
68 @property (nonatomic) char selected; // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'MKAnnotationView'}} \
anatofuz
parents:
diff changeset
69 // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'P2'}}
anatofuz
parents:
diff changeset
70 @property (nonatomic) char selected1; // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'Parent'}}
anatofuz
parents:
diff changeset
71 @property (nonatomic) char selected2;
anatofuz
parents:
diff changeset
72 @end