OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Tests that typechecks on const objects with typedefs work. | 5 // Tests that typechecks on const objects with typedefs work. |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 typedef String Int2String(int x); | 9 typedef String Int2String(int x); |
10 | 10 |
11 class A { | 11 class A { |
12 final Int2String f; | 12 final Int2String f; |
13 const A(this.f); | 13 const A(this.f); |
14 } | 14 } |
15 | 15 |
16 int // //# 00: static type warning, checked mode compile-time error | 16 int // //# 00: static type warning, checked mode compile-time error |
17 foo( | 17 foo( |
18 String // //# 00: continued | 18 String // //# 00: continued |
19 x) => 499; | 19 x) => |
| 20 499; |
20 | 21 |
21 const a = const A(foo); | 22 const a = const A(foo); |
22 | 23 |
23 main() { | 24 main() { |
24 Expect.equals(499, a.f(499)); | 25 Expect.equals(499, a.f(499)); |
25 } | 26 } |
OLD | NEW |