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

Side by Side Diff: pkg/kernel/testcases/reify/generic_methods_tearoff_specialization_test.dart

Issue 2756693002: Add generic-methods 'golden' tests for 'reify' transformation (Closed)
Patch Set: Created 3 years, 9 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 "test_base.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 expectTrue(f is Int2Int);
29 expectTrue(f is! String2String);
30 expectTrue(f is! Object2Object);
31 expectTrue(f is! GenericMethod);
32
33 expectTrue(g is! Int2Int);
34 expectTrue(g is String2String);
35 expectTrue(g is! Object2Object);
36 expectTrue(g is! GenericMethod);
37
38 expectTrue(h is! Int2Int);
39 expectTrue(h is! String2String);
40 expectTrue(h is Object2Object);
41 expectTrue(g is! GenericMethod);
42
43 expectTrue(generic is! Int2Int);
44 expectTrue(generic is! String2String);
45 expectTrue(generic is! Object2Object);
46 expectTrue(generic is GenericMethod);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698