| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /*@testedFeatures=inference*/ |
| 6 library test; |
| 7 |
| 8 class A { |
| 9 T f<T>(T t) => t; |
| 10 int g(dynamic i) => 0; |
| 11 } |
| 12 |
| 13 var /*@topType=A*/ a = new A(); |
| 14 |
| 15 // There's a circularity between b and c because a.f is generic, so the type of |
| 16 // c is required to infer b, and vice versa. |
| 17 |
| 18 var /*@topType=() -> dynamic*/ b = /*@returnType=() -> dynamic*/ () => |
| 19 a. /*@typeArgs=() -> dynamic*/ /*@target=A::f*/ f(c); |
| 20 var /*@topType=() -> dynamic*/ c = /*@returnType=() -> dynamic*/ () => |
| 21 a. /*@typeArgs=() -> dynamic*/ /*@target=A::f*/ f(b); |
| 22 |
| 23 // e's use of a.g breaks the circularity, because a.g is not generic, therefore |
| 24 // the type of e does not depend on the type of d. |
| 25 |
| 26 var /*@topType=() -> dynamic*/ d = /*@returnType=() -> int*/ () => |
| 27 a. /*@typeArgs=() -> int*/ /*@target=A::f*/ f(e); |
| 28 var /*@topType=() -> int*/ e = /*@returnType=int*/ () => |
| 29 a. /*@target=A::g*/ g(d); |
| 30 |
| 31 main() {} |
| OLD | NEW |