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

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

Issue 2737933002: Add tests for generic methods in strong mode (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 library generic_methods_tearoff_deferred_specialization2_test;
6
7 import "package:expect/expect.dart";
8
9 class A {
10 T fun<T>(T t) => t;
11 }
12
13 typedef Int2Int = int Function(int);
14 typedef String2String = String Function(String);
15 typedef Object2Object = Object Function(Object);
16 typedef GenericMethod = T Function<T>(T);
17
18 main() {
19 A a = new A();
20 Int2Int f = a.fun;
21 String2String g = a.fun;
22 Object2Object h = a.fun;
23 var generic = a.fun;
24
25 Expect.isTrue(f is Int2Int);
26 Expect.isTrue(f is! String2String);
27 Expect.isTrue(f is! Object2Object);
28 Expect.isTrue(f is! GenericMethod);
29
30 Expect.isTrue(g is! Int2Int);
31 Expect.isTrue(g is String2String);
32 Expect.isTrue(g is! Object2Object);
33 Expect.isTrue(g is! GenericMethod);
34
35 Expect.isTrue(h is! Int2Int);
36 Expect.isTrue(h is! String2String);
37 Expect.isTrue(h is Object2Object);
38 Expect.isTrue(g is! GenericMethod);
39
40 Expect.isTrue(generic is! Int2Int);
41 Expect.isTrue(generic is! String2String);
42 Expect.isTrue(generic is! Object2Object);
43 Expect.isTrue(generic is GenericMethod);
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698