Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart

Issue 2954063002: Small fixes to top level type inference. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 T f<T>(T t) => t; 9 T f<T>(T t) => t;
10 int g(dynamic i) => 0; 10 int g(dynamic i) => 0;
11 } 11 }
12 12
13 var /*@topType=A*/ a = new A(); 13 var /*@topType=A*/ a = new A();
14 14
15 // There's a circularity between b and c because a.f is generic, so the type of 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. 16 // c is required to infer b, and vice versa.
17 17
18 var /*@topType=() -> dynamic*/ b = /*@returnType=() -> dynamic*/ () => 18 var /*@topType=dynamic*/ b = /*@returnType=dynamic*/ () =>
19 a. /*@typeArgs=() -> dynamic*/ /*@target=A::f*/ f(c); 19 a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(c);
20 var /*@topType=() -> dynamic*/ c = /*@returnType=() -> dynamic*/ () => 20 var /*@topType=dynamic*/ c = /*@returnType=dynamic*/ () =>
21 a. /*@typeArgs=() -> dynamic*/ /*@target=A::f*/ f(b); 21 a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(b);
22 22
23 // e's use of a.g breaks the circularity, because a.g is not generic, therefore 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. 24 // the type of e does not depend on the type of d.
25 25
26 var /*@topType=() -> dynamic*/ d = /*@returnType=() -> int*/ () => 26 var /*@topType=() -> () -> int*/ d = /*@returnType=() -> int*/ () =>
27 a. /*@typeArgs=() -> int*/ /*@target=A::f*/ f(e); 27 a. /*@typeArgs=() -> int*/ /*@target=A::f*/ f(e);
28 var /*@topType=() -> int*/ e = /*@returnType=int*/ () => 28 var /*@topType=() -> int*/ e = /*@returnType=int*/ () =>
29 a. /*@target=A::g*/ g(d); 29 a. /*@target=A::g*/ g(d);
30 30
31 main() {} 31 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698