Chromium Code Reviews| Index: tests/language/function_subtype_call2_test.dart |
| diff --git a/tests/language/function_subtype_call2_test.dart b/tests/language/function_subtype_call2_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..517d4d1d3c3f68c8362590260f9ba59e3a11afdc |
| --- /dev/null |
| +++ b/tests/language/function_subtype_call2_test.dart |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// Dart test program for constructors and initializers. |
| + |
| +// Check function subtyping for classes with call functions. |
| + |
| +import 'package:expect/expect.dart'; |
| + |
| +typedef void Foo(bool a, [String b]); |
| +typedef void Bar(bool a, [String b]); |
| +typedef void Baz(bool a, {String b}); |
| +typedef void Boz(bool a); |
| + |
| +class C1<T> { |
| + void call(T a, [String b]) {} |
| +} |
| + |
| +class D1<S,T> extends C1<T> {} |
|
karlklose
2013/06/20 13:11:04
Space between type variables (also l.25)
Johnni Winther
2013/06/21 12:19:15
Done.
|
| + |
| +class C2<T> { |
| + void call(T a, {String b}) {} |
| +} |
| + |
| +class D2<S,T> extends C2<T> {} |
| + |
| +main() { |
| + Expect.isTrue(new D1<String, bool>() is Foo, 'new D1<String, bool>() is Foo'); |
| + Expect.isTrue(new D1<String, bool>() is Bar, 'new D1<String, bool>() is Bar'); |
| + Expect.isFalse(new D1<String, bool>() is Baz, 'new D1<String, bool>() is Baz'); |
|
karlklose
2013/06/20 13:11:04
Three long lines (l.30, 43, 44).
Johnni Winther
2013/06/21 12:19:15
Done.
|
| + Expect.isTrue(new D1<String, bool>() is Boz, 'new D1<String, bool>() is Boz'); |
| + |
| + Expect.isFalse(new D1<bool, int>() is Foo, 'new D1<bool, int>() is Foo'); |
| + Expect.isFalse(new D1<bool, int>() is Bar, 'new D1<bool, int>() is Bar'); |
| + Expect.isFalse(new D1<bool, int>() is Baz, 'new D1<bool, int>() is Baz'); |
| + Expect.isFalse(new D1<bool, int>() is Boz, 'new D1<bool, int>() is Boz'); |
| + |
| + Expect.isTrue(new D1() is Foo, 'new D1() is Foo'); |
| + Expect.isTrue(new D1() is Bar, 'new D1() is Bar'); |
| + Expect.isFalse(new D1() is Baz, 'new D1() is Baz'); |
| + Expect.isTrue(new D1() is Boz, 'new D1() is Boz'); |
| + |
| + Expect.isFalse(new D2<String, bool>() is Foo, 'new D2<String, bool>() is Foo'); |
| + Expect.isFalse(new D2<String, bool>() is Bar, 'new D2<String, bool>() is Bar'); |
| + Expect.isTrue(new D2<String, bool>() is Baz, 'new D2<String, bool>() is Baz'); |
| + Expect.isTrue(new D2<String, bool>() is Boz, 'new D2<String, bool>() is Boz'); |
| + |
| + Expect.isFalse(new D2<bool, int>() is Foo, 'new D2<bool, int>() is Foo'); |
| + Expect.isFalse(new D2<bool, int>() is Bar, 'new D2<bool, int>() is Bar'); |
| + Expect.isFalse(new D2<bool, int>() is Baz, 'new D2<bool, int>() is Baz'); |
| + Expect.isFalse(new D2<bool, int>() is Boz, 'new D2<bool, int>() is Boz'); |
| + |
| + Expect.isFalse(new D2() is Foo, 'new D2() is Foo'); |
| + Expect.isFalse(new D2() is Bar, 'new D2() is Bar'); |
| + Expect.isTrue(new D2() is Baz, 'new D2() is Baz'); |
| + Expect.isTrue(new D2() is Boz, 'new D2() is Boz'); |
| +} |