OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 class X { | 7 class X { |
8 call() => 42; | 8 call() => 42; |
9 } | 9 } |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 static int staticMethod(int x) => x + 1; | 26 static int staticMethod(int x) => x + 1; |
27 } | 27 } |
28 | 28 |
29 typedef F(int x); | 29 typedef F(int x); |
30 typedef G(String y); | 30 typedef G(String y); |
31 typedef H(); | 31 typedef H(); |
32 | 32 |
33 main() { | 33 main() { |
34 X x = new X(); | 34 X x = new X(); |
35 Function f = x; // Should pass checked mode test | 35 Function f = x; // Should pass checked mode test |
sra1
2017/03/21 03:28:14
fix?
| |
36 Y y = new Y(); | 36 Y y = new Y(); |
37 Function g = y; // Should pass checked mode test | 37 Function g = y; // Should pass checked mode test |
38 F f0 = y; // Should pass checked mode test | 38 F f0 = y; // Should pass checked mode test |
39 F f1 = x; /// 00: dynamic type error, static type warning | 39 F f1 = x; // /// 00: dynamic type error, static type warning |
40 G g0 = y; /// 01: dynamic type error, static type warning | 40 G g0 = y; // /// 01: dynamic type error, static type warning |
41 | 41 |
42 Expect.equals(f(), 42); | 42 Expect.equals(f(), 42); |
43 Expect.equals(g(100), 187); | 43 Expect.equals(g(100), 187); |
44 | 44 |
45 var z = new Z<int>(123); | 45 var z = new Z<int>(123); |
46 Expect.equals(z(), 123); | 46 Expect.equals(z(), 123); |
47 // TODO(jmesserly): this test doesn't work yet. | 47 // TODO(jmesserly): this test doesn't work yet. |
48 // Expect.equals((z as dynamic)(), 123); | 48 // Expect.equals((z as dynamic)(), 123); |
49 | 49 |
50 Expect.equals(Y.staticMethod(6), 7); | 50 Expect.equals(Y.staticMethod(6), 7); |
51 Expect.equals(Z.staticMethod(6), 7); | 51 Expect.equals(Z.staticMethod(6), 7); |
52 | 52 |
53 var xx = new XX.named(); | 53 var xx = new XX.named(); |
54 Expect.equals(xx(), 42); | 54 Expect.equals(xx(), 42); |
55 | 55 |
56 H xx2 = new XX.named(); | 56 H xx2 = new XX.named(); |
57 Expect.equals(xx2(), 42); | 57 Expect.equals(xx2(), 42); |
58 } | 58 } |
OLD | NEW |