blob: f161bb8d9948bf3413166ce300e7629f4ff288c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: cp %s %t
// RUN: %clang_cc1 -fsyntax-only -fixit %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c %t
// XFAIL: *
@interface NSString // expected-note{{'NSString' declared here}}
+ (int)method:(int)x;
@end
void test() {
// FIXME: not providing fix-its
NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}}
}
@protocol P1
@optional
@property int *sprop; // expected-note{{'sprop' declared here}}
@end
@interface A
{
int his_ivar; // expected-note 2{{'his_ivar' declared here}}
float wibble;
}
@property int his_prop; // expected-note{{'his_prop' declared here}}
@end
@interface B : A <P1>
{
int her_ivar; // expected-note 2{{'her_ivar' declared here}}
}
@property int her_prop; // expected-note{{'her_prop' declared here}}
- (void)inst_method1:(int)a;
+ (void)class_method1;
@end
@implementation A
@synthesize his_prop = his_ivar;
@end
@implementation B
@synthesize her_prop = her_ivar;
-(void)inst_method1:(int)a {
herivar = a; // expected-error{{use of undeclared identifier 'herivar'; did you mean 'her_ivar'?}}
hisivar = a; // expected-error{{use of undeclared identifier 'hisivar'; did you mean 'his_ivar'?}}
self->herivar = a; // expected-error{{'B' does not have a member named 'herivar'; did you mean 'her_ivar'?}}
self->hisivar = a; // expected-error{{'B' does not have a member named 'hisivar'; did you mean 'his_ivar'?}}
self.hisprop = 0; // expected-error{{property 'hisprop' not found on object of type 'B *'; did you mean 'his_prop'?}}
self.herprop = 0; // expected-error{{property 'herprop' not found on object of type 'B *'; did you mean 'her_prop'?}}
self.s_prop = 0; // expected-error{{property 's_prop' not found on object of type 'B *'; did you mean 'sprop'?}}
}
+(void)class_method1 {
}
@end
void test_message_send(B* b) {
[NSstring method:17]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
}
@interface Collide // expected-note{{'Collide' declared here}}
{
@public
int value; // expected-note{{'value' declared here}}
}
@property int value; // expected-note{{'value' declared here}}
@end
@implementation Collide
@synthesize value = value;
@end
void test2(Collide *a) {
a.valu = 17; // expected-error{{property 'valu' not found on object of type 'Collide *'; did you mean 'value'?}}
a->vale = 17; // expected-error{{'Collide' does not have a member named 'vale'; did you mean 'value'?}}
}
@interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}}
@end
@protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}}
- (int)send:(void*)buffer bytes:(int)bytes;
@end
@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}}
@end
@interface Super
- (int)method;
@end
@interface Sub : Super
- (int)method;
@end
@implementation Sub
- (int)method {
return [supper method]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}
}
@end
@interface Ivar
@end
@protocol Proto
@property (retain) id ivar;
@end
@interface User <Proto>
- (void)method;
@end
@implementation User
@synthesize ivar;
- (void)method {
[ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
}
@end
@interface User2
@end
@interface User2 (Cat) < Proto>
- (void)method;
@end
@implementation User2 (Cat)
@synthesize ivar;
- (void)method {
[ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
}
@end
|