OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 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 | 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 of generic functions. | 5 // Tests of generic functions. |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 | 8 |
9 typedef R Foo<R>(); | 9 typedef R Foo<R>(); |
10 | 10 |
11 bar<R>(int body()) { | 11 bar<R>(int body()) { |
12 var function = () { | 12 var function = () { |
13 if (body is Foo<R>) { | 13 if (body is Foo<R>) { |
14 return body(); | 14 return body(); |
15 } | 15 } |
16 return 42; | 16 return 42; |
17 }; | 17 }; |
18 return function(); | 18 return function(); |
19 } | 19 } |
20 | 20 |
21 main(args) { | 21 main() { |
22 Expect.isTrue(bar(() => 43) == 43); | 22 Expect.isTrue(bar(() => 43) == 43); |
23 } | 23 } |
OLD | NEW |