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

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

Issue 12087052: Implement Types.isSubtype for FunctionType with optional and named parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased (again) Created 7 years, 10 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
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 is-test of typedefs with optional and named parameters.
6
7 typedef int Func1(int a);
8 typedef int Func2(int a, [int b]);
9 typedef int Func3(int a, [int b, int c]);
10 typedef int Func4([int a, int b, int c]);
11 typedef int Func5(int a, {int b});
12 typedef int Func6(int a, {int b, int c});
13 typedef int Func7({int a, int b, int c});
14
15 void main() {
16 int func1(int i) {}
17 Expect.isTrue(func1 is Func1);
18 Expect.isFalse(func1 is Func2);
19 Expect.isFalse(func1 is Func3);
20 Expect.isFalse(func1 is Func4);
21 Expect.isFalse(func1 is Func5);
22 Expect.isFalse(func1 is Func6);
23 Expect.isFalse(func1 is Func7);
24
25 int func2(int i, int j) {}
26 Expect.isFalse(func2 is Func1);
27 Expect.isFalse(func2 is Func2);
28 Expect.isFalse(func2 is Func3);
29 Expect.isFalse(func2 is Func4);
30 Expect.isFalse(func2 is Func5);
31 Expect.isFalse(func2 is Func6);
32 Expect.isFalse(func2 is Func7);
33
34 int func3(int i, int j, int k) {}
35 Expect.isFalse(func3 is Func1);
36 Expect.isFalse(func3 is Func2);
37 Expect.isFalse(func3 is Func3);
38 Expect.isFalse(func3 is Func4);
39 Expect.isFalse(func3 is Func5);
40 Expect.isFalse(func3 is Func6);
41 Expect.isFalse(func3 is Func7);
42
43 int func4(int i, [int j]) {}
44 Expect.isTrue(func4 is Func1);
45 Expect.isTrue(func4 is Func2);
46 Expect.isFalse(func4 is Func3);
47 Expect.isFalse(func4 is Func4);
48 Expect.isFalse(func4 is Func5);
49 Expect.isFalse(func4 is Func6);
50 Expect.isFalse(func4 is Func7);
51
52 int func5(int i, [int j, int k]) {}
53 Expect.isTrue(func5 is Func1);
54 Expect.isTrue(func5 is Func2);
55 Expect.isTrue(func5 is Func3);
56 Expect.isFalse(func5 is Func4);
57 Expect.isFalse(func5 is Func5);
58 Expect.isFalse(func5 is Func6);
59 Expect.isFalse(func5 is Func7);
60
61 int func6([int i, int j, int k]) {}
62 Expect.isFalse(func6 is Func1);
63 Expect.isFalse(func6 is Func2);
64 Expect.isFalse(func6 is Func3);
65 Expect.isTrue(func6 is Func4);
66 Expect.isFalse(func6 is Func5);
67 Expect.isFalse(func6 is Func6);
68 Expect.isFalse(func6 is Func7);
69
70 int func7(int i, {int j}) {}
71 Expect.isTrue(func7 is Func1);
72 Expect.isFalse(func7 is Func2);
73 Expect.isFalse(func7 is Func3);
74 Expect.isFalse(func7 is Func4);
75 Expect.isFalse(func7 is Func5);
76 Expect.isFalse(func7 is Func6);
77 Expect.isFalse(func7 is Func7);
78
79 int func8(int i, {int b}) {}
80 Expect.isTrue(func8 is Func1);
81 Expect.isFalse(func8 is Func2);
82 Expect.isFalse(func8 is Func3);
83 Expect.isFalse(func8 is Func4);
84 Expect.isTrue(func8 is Func5);
85 Expect.isFalse(func8 is Func6);
86 Expect.isFalse(func8 is Func7);
87
88 int func9(int i, {int b, int c}) {}
89 Expect.isTrue(func9 is Func1);
90 Expect.isFalse(func9 is Func2);
91 Expect.isFalse(func9 is Func3);
92 Expect.isFalse(func9 is Func4);
93 Expect.isTrue(func9 is Func5);
94 Expect.isTrue(func9 is Func6);
95 Expect.isFalse(func9 is Func7);
96
97 int func10(int i, {int c, int b}) {}
98 Expect.isTrue(func10 is Func1);
99 Expect.isFalse(func10 is Func2);
100 Expect.isFalse(func10 is Func3);
101 Expect.isFalse(func10 is Func4);
102 Expect.isTrue(func10 is Func5);
103 Expect.isTrue(func10 is Func6);
104 Expect.isFalse(func10 is Func7);
105
106 int func11({int a, int b, int c}) {}
107 Expect.isFalse(func11 is Func1);
108 Expect.isFalse(func11 is Func2);
109 Expect.isFalse(func11 is Func3);
110 Expect.isFalse(func11 is Func4);
111 Expect.isFalse(func11 is Func5);
112 Expect.isFalse(func11 is Func6);
113 Expect.isTrue(func11 is Func7);
114
115 int func12({int c, int a, int b}) {}
116 Expect.isFalse(func12 is Func1);
117 Expect.isFalse(func12 is Func2);
118 Expect.isFalse(func12 is Func3);
119 Expect.isFalse(func12 is Func4);
120 Expect.isFalse(func12 is Func5);
121 Expect.isFalse(func12 is Func6);
122 Expect.isTrue(func12 is Func7);
123 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698