• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3@interface A
4-(float) x;	// expected-note {{declared here}}
5@property int x; // expected-warning {{type of property 'x' does not match type of accessor 'x'}}
6@end
7
8@interface A (Cat)
9@property int moo;	// expected-note {{previous definition is here}}
10@end
11
12@implementation A (Cat)
13-(int) moo {
14  return 0;
15}
16-(void) setMoo: (float) x { // expected-warning {{conflicting parameter types in implementation of 'setMoo:': 'int' vs 'float'}}
17}
18@end
19
20
21typedef int T[2];
22typedef void (F)(void);
23
24@interface C
25@property(assign) T p2;  // expected-error {{property cannot have array or function type 'T'}}
26
27@property(assign) F f2; // expected-error {{property cannot have array or function type 'F'}}
28
29@end
30
31
32@class SSyncSet;
33
34@interface SPeer
35  @property(nonatomic,readonly,retain) SSyncSet* syncSet;
36@end
37
38@class SSyncSet_iDisk;
39
40@interface SPeer_iDisk_remote1 : SPeer
41- (SSyncSet_iDisk*) syncSet; // expected-note {{declared here}}
42@end
43
44@interface SPeer_iDisk_local
45- (SSyncSet_iDisk*) syncSet;
46@end
47
48@interface SSyncSet
49@end
50
51@interface SSyncSet_iDisk
52@property(nonatomic,readonly,retain) SPeer_iDisk_local* localPeer;
53@end
54
55@interface SPeer_iDisk_remote1 (protected)
56@end
57
58@implementation SPeer_iDisk_remote1 (protected)
59- (id) preferredSource1
60{
61  return self.syncSet.localPeer; // expected-warning {{type of property 'syncSet' does not match type of accessor 'syncSet'}}
62}
63@end
64
65@interface NSArray @end
66
67@interface NSMutableArray : NSArray
68@end
69
70@interface Class1
71{
72 NSMutableArray* pieces;
73 NSArray* first;
74}
75
76@property (readonly) NSArray* pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}
77@property (readonly) NSMutableArray* first;
78
79- (NSMutableArray*) pieces; // expected-note 2 {{declared here}}
80- (NSArray*) first;
81@end
82
83@interface Class2  {
84 Class1* container;
85}
86
87@end
88
89@implementation Class2
90
91- (id) lastPiece
92{
93 return container.pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}
94}
95
96- (id)firstPiece
97{
98  return container.first;
99}
100@end
101
102