OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /*@testedFeatures=inference*/ | 5 /*@testedFeatures=inference*/ |
6 library test; | 6 library test; |
7 | 7 |
8 class A { | 8 class A { |
9 int x = 42; | 9 int x = 42; |
10 } | 10 } |
11 | 11 |
12 class B { | 12 class B { |
13 A a = new A(); | 13 A a = new A(); |
14 } | 14 } |
15 | 15 |
16 class C { | 16 class C { |
17 B b = new B(); | 17 B b = new B(); |
18 } | 18 } |
19 | 19 |
20 class D { | 20 class D { |
21 C c = new C(); | 21 C c = new C(); |
22 } | 22 } |
23 | 23 |
24 void main() { | 24 void main() { |
25 var /*@type=D*/ d1 = new D(); | 25 var /*@type=D*/ d1 = new D(); |
26 print(d1.c.b.a.x); | 26 print(d1. /*@target=D::c*/ c. /*@target=C::b*/ b. /*@target=B::a*/ a |
| 27 . /*@target=A::x*/ x); |
27 | 28 |
28 D d2 = new D(); | 29 D d2 = new D(); |
29 print(d2.c.b.a.x); | 30 print(d2. /*@target=D::c*/ c. /*@target=C::b*/ b. /*@target=B::a*/ a |
| 31 . /*@target=A::x*/ x); |
30 } | 32 } |
OLD | NEW |