OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, 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 |
| 5 import 'package:expect/expect.dart'; |
| 6 |
| 7 typedef O Convert<I, O>(I input); |
| 8 typedef Other(a, b); |
| 9 |
| 10 class Mixin<E> { |
| 11 E convert1<I>(I input) => null; |
| 12 } |
| 13 |
| 14 class Class<F> extends Object with Mixin<F> { |
| 15 O convert2<O>(F input) => null; |
| 16 } |
| 17 |
| 18 O convert<I, O>(I input) => null; |
| 19 |
| 20 test1() { |
| 21 var val = new Class<String>(); |
| 22 Expect.isTrue(val.convert1 is Convert); |
| 23 Expect.isTrue(val.convert1 is Convert<String, String>); |
| 24 Expect.isTrue(val.convert1 is Convert<int, String>); |
| 25 Expect.isFalse(val.convert1 is Convert<String, int>); |
| 26 Expect.isFalse(val.convert1 is Other); |
| 27 } |
| 28 |
| 29 test2() { |
| 30 var val = new Class<String>(); |
| 31 Expect.isTrue(val.convert2 is Convert); |
| 32 Expect.isTrue(val.convert2 is Convert<String, String>); |
| 33 Expect.isTrue(val.convert2 is Convert<String, int>); |
| 34 Expect.isFalse(val.convert2 is Convert<int, String>); |
| 35 Expect.isFalse(val.convert2 is Other); |
| 36 } |
| 37 |
| 38 test3() { |
| 39 Expect.isTrue(convert is Convert); |
| 40 Expect.isTrue(convert is Convert<String, String>); |
| 41 Expect.isTrue(convert is Convert<String, int>); |
| 42 Expect.isTrue(convert is Convert<int, String>); |
| 43 Expect.isFalse(convert is Other); |
| 44 } |
| 45 |
| 46 main() { |
| 47 test1(); /// 01: ok |
| 48 test2(); /// 02: ok |
| 49 test3(); /// 03: ok |
| 50 } |
OLD | NEW |