1 | // RUN: %clang_cc1 %s -verify -fsyntax-only -fobjc-runtime=ios |
2 | |
3 | @protocol P |
4 | -(id)description; |
5 | @end |
6 | |
7 | @interface B<P> |
8 | @property int x; |
9 | @end |
10 | |
11 | @interface S : B { |
12 | id _someivar; // expected-note {{here}} |
13 | } |
14 | @end |
15 | |
16 | // Spell-checking 'undefined' is ok. |
17 | undefined var; // expected-error {{unknown type name}} |
18 | |
19 | typedef int super1; |
20 | @implementation S |
21 | -(void)foo:(id)p1 other:(id)p2 { |
22 | // Spell-checking 'super' is not ok. |
23 | super.x = 0; |
24 | self.x = 0; |
25 | } |
26 | |
27 | -(void)test { |
28 | [self foo:[super description] other:someivar]; // expected-error {{use of undeclared identifier 'someivar'; did you mean '_someivar'?}} |
29 | } |
30 | @end |
31 | |
32 | __attribute__ (( __objc_root_class__ )) |
33 | @interface I { |
34 | id _interface; // expected-note {{'_interface' declared here}} |
35 | } |
36 | -(void)method; |
37 | @end |
38 | |
39 | @interface I () { |
40 | id _extension; // expected-note {{'_extension' declared here}} |
41 | } |
42 | @end |
43 | |
44 | @implementation I { |
45 | id _implementation; // expected-note {{'_implementation' declared here}} |
46 | } |
47 | -(void)method { |
48 | (void)self->implementation; // expected-error {{'I' does not have a member named 'implementation'; did you mean '_implementation'?}} |
49 | (void)self->interface; // expected-error {{'I' does not have a member named 'interface'; did you mean '_interface'?}} |
50 | (void)self->extension; // expected-error {{'I' does not have a member named 'extension'; did you mean '_extension'?}} |
51 | } |
52 | @end |
53 | |
54 | // rdar://problem/33102722 |
55 | // Typo correction for a property when it has as correction candidates |
56 | // synthesized ivar and a class name, both at the same edit distance. |
57 | @class TypoCandidate; |
58 | |
59 | __attribute__ (( __objc_root_class__ )) |
60 | @interface PropertyType |
61 | @property int x; |
62 | @end |
63 | |
64 | __attribute__ (( __objc_root_class__ )) |
65 | @interface InterfaceC |
66 | @property(assign) PropertyType *typoCandidate; // expected-note {{'_typoCandidate' declared here}} |
67 | @end |
68 | |
69 | @implementation InterfaceC |
70 | -(void)method { |
71 | typoCandidate.x = 0; // expected-error {{use of undeclared identifier 'typoCandidate'; did you mean '_typoCandidate'?}} |
72 | } |
73 | @end |
74 | |