OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 class FunctionLike<T> { |
| 8 call(T arg) { |
| 9 return arg; |
| 10 } |
| 11 } |
| 12 |
| 13 class Foo<T> { |
| 14 testString() => new FunctionLike<String>() is T; |
| 15 testInt() => new FunctionLike<int>() is T; |
| 16 } |
| 17 |
| 18 typedef TakeString(String arg); |
| 19 typedef TakeInt(int arg); |
| 20 |
| 21 main() { |
| 22 Foo<TakeString> stringFoo = new Foo<TakeString>(); |
| 23 Foo<TakeInt> intFoo = new Foo<TakeInt>(); |
| 24 |
| 25 Expect.isTrue(stringFoo.testString()); |
| 26 Expect.isFalse(stringFoo.testInt()); |
| 27 |
| 28 Expect.isFalse(intFoo.testString()); |
| 29 Expect.isTrue(intFoo.testInt()); |
| 30 } |
OLD | NEW |