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

Side by Side Diff: tests/language_strong/generic_methods_tearoff_specialization_test.dart

Issue 3001803002: Migrate block 114 (and some of 113). (Closed)
Patch Set: Tweak app_jit status. 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
(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 // Test that generic methods can be specialized after being torn off, and that
6 // their specialized versions are correctly constructed.
7
8 library generic_methods_tearoff_specialization_test;
9
10 import "package:expect/expect.dart";
11
12 class A {
13 T fun<T>(T t) => t;
14 }
15
16 typedef Int2Int = int Function(int);
17 typedef String2String = String Function(String);
18 typedef Object2Object = Object Function(Object);
19 typedef GenericMethod = T Function<T>(T);
20
21 main() {
22 A a = new A();
23 Int2Int f = a.fun;
24 String2String g = a.fun;
25 Object2Object h = a.fun;
26 var generic = a.fun;
27
28 Expect.isTrue(f is Int2Int);
29 Expect.isTrue(f is! String2String);
30 Expect.isTrue(f is! Object2Object);
31 Expect.isTrue(f is! GenericMethod);
32
33 Expect.isTrue(g is! Int2Int);
34 Expect.isTrue(g is String2String);
35 Expect.isTrue(g is! Object2Object);
36 Expect.isTrue(g is! GenericMethod);
37
38 Expect.isTrue(h is! Int2Int);
39 Expect.isTrue(h is! String2String);
40 Expect.isTrue(h is Object2Object);
41 Expect.isTrue(g is! GenericMethod);
42
43 Expect.isTrue(generic is! Int2Int);
44 Expect.isTrue(generic is! String2String);
45 Expect.isTrue(generic is! Object2Object);
46 Expect.isTrue(generic is GenericMethod);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698