OLD | NEW |
(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 for local functions. |
| 7 |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 typedef int Foo(bool a, [String b]); |
| 11 typedef int Bar(bool a, [String b]); |
| 12 typedef int Baz(bool a, {String b}); |
| 13 typedef int Boz(bool a); |
| 14 |
| 15 main() { |
| 16 int foo(bool a, [String b]) => null; |
| 17 int baz(bool a, {String b}) => null; |
| 18 int boz(bool a, {int b}) => null; |
| 19 |
| 20 Expect.isTrue(foo is Foo, 'foo is Foo'); |
| 21 Expect.isTrue(foo is Bar, 'foo is Bar'); |
| 22 Expect.isFalse(foo is Baz, 'foo is Baz'); |
| 23 Expect.isTrue(foo is Boz, 'foo is Boz'); |
| 24 |
| 25 Expect.isFalse(baz is Foo, 'baz is Foo'); |
| 26 Expect.isFalse(baz is Bar, 'baz is Bar'); |
| 27 Expect.isTrue(baz is Baz, 'baz is Baz'); |
| 28 Expect.isTrue(baz is Boz, 'baz is Boz'); |
| 29 |
| 30 Expect.isFalse(boz is Foo, 'boz is Foo'); |
| 31 Expect.isFalse(boz is Bar, 'boz is Bar'); |
| 32 Expect.isFalse(boz is Baz, 'boz is Baz'); |
| 33 Expect.isTrue(boz is Boz, 'boz is Boz'); |
| 34 } |
OLD | NEW |