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

Side by Side Diff: tests/language/function_subtype_named1_test.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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 // Dart test program for constructors and initializers.
5
6 // Check function subtyping.
7
8 import 'package:expect/expect.dart';
9
10 void void_() {}
11 void void__int(int i) {}
12 void void___a_int({int a}) {}
13 void void___a_int2({int a}) {}
14 void void___b_int({int b}) {}
15 void void___a_Object({Object a}) {}
16 void void__int__a_int(int i1, {int a}) {}
17 void void__int__a_int2(int i1, {int a}) {}
18 void void___a_double({double a}) {}
19 void void___a_int_b_int({int a, int b}) {}
20 void void___a_int_b_int_c_int({int a, int b, int c}) {}
21 void void___a_int_c_int({int a, int c}) {}
22 void void___b_int_c_int({int b, int c}) {}
23 void void___c_int({int c}) {}
24
25 typedef void t_void_();
26 typedef void t_void__int(int i);
27 typedef void t_void___a_int({int a});
28 typedef void t_void___a_int2({int a});
29 typedef void t_void___b_int({int b});
30 typedef void t_void___a_Object({Object a});
31 typedef void t_void__int__a_int(int i1, {int a});
32 typedef void t_void__int__a_int2(int i1, {int a});
33 typedef void t_void___a_double({double a});
34 typedef void t_void___a_int_b_int({int a, int b});
35 typedef void t_void___a_int_b_int_c_int({int a, int b, int c});
36 typedef void t_void___a_int_c_int({int a, int c});
37 typedef void t_void___b_int_c_int({int b, int c});
38 typedef void t_void___c_int({int c});
39
40 main() {
41 // Test ({int a})->void <: ()->void.
42 Expect.isTrue(void___a_int is t_void_);
43 // Test ({int a})->void <: (int)->void.
44 Expect.isFalse(void___a_int is t_void__int);
45 // Test (int)->void <: ({int a})->void.
46 Expect.isFalse(void__int is t_void___a_int);
47 // Test ({int a})->void <: ({int a})->void.
48 Expect.isTrue(void___a_int is t_void___a_int2);
49 // Test ({int a})->void <: ({int b})->void.
50 Expect.isFalse(void___a_int is t_void___b_int);
51 // Test ({Object a})->void <: ({int a})->void.
52 Expect.isTrue(void___a_Object is t_void___a_int);
53 // Test ({int a})->void <: ({Object a})->void.
54 Expect.isTrue(void___a_int is t_void___a_Object);
55 // Test (int,{int a})->void <: (int,{int a})->void.
56 Expect.isTrue(void__int__a_int is t_void__int__a_int2);
57 // Test ({int a})->void <: ({double a})->void.
58 Expect.isFalse(void___a_int is t_void___a_double);
59 // Test ({int a})->void <: ({int a,int b})->void.
60 Expect.isFalse(void___a_int is t_void___a_int_b_int);
61 // Test ({int a,int b})->void <: ({int a})->void.
62 Expect.isTrue(void___a_int_b_int is t_void___a_int);
63 // Test ({int a,int b,int c})->void <: ({int a,int c})->void.
64 Expect.isTrue(void___a_int_b_int_c_int is t_void___a_int_c_int);
65 // Test ({int a,int b,int c})->void <: ({int b,int c})->void.
66 Expect.isTrue(void___a_int_b_int_c_int is t_void___b_int_c_int);
67 // Test ({int a,int b,int c})->void <: ({int c})->void.
68 Expect.isTrue(void___a_int_b_int_c_int is t_void___c_int);
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698