1 | // RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-objc-root-class |
2 | |
3 | class ClassA {}; |
4 | |
5 | class ClassB { |
6 | public: |
7 | ClassB(ClassA* parent=0); |
8 | ~ClassB(); |
9 | }; |
10 | |
11 | @interface NSObject |
12 | @end |
13 | |
14 | @interface InterfaceA : NSObject |
15 | @property(nonatomic, assign) ClassA *m_prop1; // expected-note {{here}} |
16 | @property(nonatomic, assign) ClassB *m_prop2; |
17 | @end |
18 | |
19 | @implementation InterfaceA |
20 | - (id)test { |
21 | self.m_prop2 = new ClassB(m_prop1); // expected-error {{use of undeclared identifier 'm_prop1'; did you mean '_m_prop1'?}} |
22 | } |
23 | @end |
24 | |
25 | // rdar://30310772 |
26 | |
27 | @interface InvalidNameInIvarAndPropertyBase |
28 | { |
29 | @public |
30 | float _a; |
31 | } |
32 | @property float _b; |
33 | @end |
34 | |
35 | void invalidNameInIvarAndPropertyBase() { |
36 | float a = ((InvalidNameInIvarAndPropertyBase*)node)->_a; // expected-error {{use of undeclared identifier 'node'}} |
37 | float b = ((InvalidNameInIvarAndPropertyBase*)node)._b; // expected-error {{use of undeclared identifier 'node'}} |
38 | } |
39 | |
40 | // rdar://problem/33102722 |
41 | // Typo correction for a property when it has as correction candidates |
42 | // synthesized ivar and a class name, both at the same edit distance. |
43 | @class TypoCandidate; |
44 | |
45 | @interface PropertyType : NSObject |
46 | @property int x; |
47 | @end |
48 | |
49 | @interface InterfaceC : NSObject |
50 | @property(assign) PropertyType *typoCandidate; // expected-note {{'_typoCandidate' declared here}} |
51 | @end |
52 | |
53 | @implementation InterfaceC |
54 | -(void)method { |
55 | typoCandidate.x = 0; // expected-error {{use of undeclared identifier 'typoCandidate'; did you mean '_typoCandidate'?}} |
56 | } |
57 | @end |
58 | |
59 | // rdar://35172419 |
60 | // The scope of 'do-while' ends before typo-correction takes place. |
61 | |
62 | struct Mat2 { int rows; }; |
63 | |
64 | @implementation ImplNoInt // expected-warning {{cannot find interface declaration for 'ImplNoInt'}} |
65 | |
66 | - (void)typoCorrentInDoWhile { |
67 | Mat2 tlMat1; // expected-note {{'tlMat1' declared here}} |
68 | // Create many scopes to exhaust the cache. |
69 | do { |
70 | for (int index = 0; index < 2; index++) { |
71 | if (true) { |
72 | for (int specialTileType = 1; specialTileType < 5; specialTileType++) { |
73 | for (int i = 0; i < 10; i++) { |
74 | for (double scale = 0.95; scale <= 1.055; scale += 0.05) { |
75 | for (int j = 0; j < 10; j++) { |
76 | if (1 > 0.9) { |
77 | for (int sptile = 1; sptile < 5; sptile++) { |
78 | } |
79 | } |
80 | } |
81 | } |
82 | } |
83 | } |
84 | } |
85 | } |
86 | } while (tlMat.rows); // expected-error {{use of undeclared identifier 'tlMat'; did you mean 'tlMat1'}} |
87 | } |
88 | |
89 | @end |
90 | |