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

Side by Side Diff: tests/language_2/generic_function_dcall_test.dart

Issue 3008573002: Migrate test block 113 to Dart 2.0. (Closed)
Patch Set: Created 3 years, 3 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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 void testCallsToGenericFn() { 7 void testCallsToGenericFn() {
8 T f<T>(T a, T b) => ((a as dynamic) + b) as T; 8 T f<T>(T a, T b) => ((a as dynamic) + b) as T;
9 9
10 var x = (f as dynamic)<int>(40, 2); 10 var x = (f as dynamic)<int>(40, 2);
(...skipping 30 matching lines...) Expand all
41 Expect.equals(foo<int>(h, 42), 42); 41 Expect.equals(foo<int>(h, 42), 42);
42 Expect.equals(foo<dynamic>(h, 42), 42); 42 Expect.equals(foo<dynamic>(h, 42), 42);
43 Expect.equals(foo<int>(h as dynamic, 42), 42); 43 Expect.equals(foo<int>(h as dynamic, 42), 42);
44 Expect.equals(foo<dynamic>(h as dynamic, 42), 42); 44 Expect.equals(foo<dynamic>(h as dynamic, 42), 42);
45 } 45 }
46 46
47 void testGenericFnTypeToString() { 47 void testGenericFnTypeToString() {
48 T f<T>(T a) => a; 48 T f<T>(T a) => a;
49 // TODO(jmesserly): other Dart implementations use `=>` arrow, so we may need 49 // TODO(jmesserly): other Dart implementations use `=>` arrow, so we may need
50 // to change this in DDC at some point. 50 // to change this in DDC at some point.
51 Expect.equals(f.runtimeType.toString(), "<T>(T) -> T"); 51 Expect.equals(f.runtimeType.toString(), "<T>(T) -> T");
Jennifer Messerly 2017/08/25 21:59:48 note that this test depends on DDC's implementatio
jcollins 2017/08/29 15:41:06 Acknowledged.
52 } 52 }
53 53
54 main() { 54 main() {
55 testCallsToGenericFn(); 55 testCallsToGenericFn();
56 testGenericFnAsArg(); 56 testGenericFnAsArg();
57 testGenericFnAsGenericFnArg(); 57 testGenericFnAsGenericFnArg();
58 testGenericFnTypeToString(); 58 testGenericFnTypeToString();
59 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698