OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Test that generic methods with named parameters are of correct type. |
| 6 |
| 7 library generic_methods_named_parameters_test; |
| 8 |
| 9 import "test_base.dart"; |
| 10 |
| 11 typedef FunObjObj = Object Function<T>(Object, {Object y}); |
| 12 typedef FunTypObj = Object Function<T>(T, {Object y}); |
| 13 typedef FunObjTyp = Object Function<T>(Object, {T y}); |
| 14 typedef FunTypTyp = Object Function<T>(T, {T y}); |
| 15 |
| 16 Object funObjObj<T>(Object x, {Object y}) => x; |
| 17 Object funTypObj<T>(T x, {Object y}) => y; |
| 18 Object funObjTyp<T>(Object x, {T y}) => x; |
| 19 Object funTypTyp<T>(T x, {T y}) => null; |
| 20 |
| 21 main() { |
| 22 expectTrue(funObjObj is FunObjObj); |
| 23 expectTrue(funObjObj is FunTypObj); |
| 24 expectTrue(funObjObj is FunObjTyp); |
| 25 expectTrue(funObjObj is FunTypTyp); |
| 26 |
| 27 expectTrue(funTypObj is! FunObjObj); |
| 28 expectTrue(funTypObj is FunTypObj); |
| 29 expectTrue(funTypObj is! FunObjTyp); |
| 30 expectTrue(funTypObj is FunTypTyp); |
| 31 |
| 32 expectTrue(funObjTyp is! FunObjObj); |
| 33 expectTrue(funObjTyp is! FunTypObj); |
| 34 expectTrue(funObjTyp is FunObjTyp); |
| 35 expectTrue(funObjTyp is FunTypTyp); |
| 36 |
| 37 expectTrue(funTypTyp is! FunObjObj); |
| 38 expectTrue(funTypTyp is! FunTypObj); |
| 39 expectTrue(funTypTyp is! FunObjTyp); |
| 40 expectTrue(funTypTyp is FunTypTyp); |
| 41 } |
OLD | NEW |