| 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 "package:expect/expect.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 Expect.isTrue(funObjObj is FunObjObj); | |
| 23 Expect.isTrue(funObjObj is FunTypObj); | |
| 24 Expect.isTrue(funObjObj is FunObjTyp); | |
| 25 Expect.isTrue(funObjObj is FunTypTyp); | |
| 26 | |
| 27 Expect.isTrue(funTypObj is! FunObjObj); | |
| 28 Expect.isTrue(funTypObj is FunTypObj); | |
| 29 Expect.isTrue(funTypObj is! FunObjTyp); | |
| 30 Expect.isTrue(funTypObj is FunTypTyp); | |
| 31 | |
| 32 Expect.isTrue(funObjTyp is! FunObjObj); | |
| 33 Expect.isTrue(funObjTyp is! FunTypObj); | |
| 34 Expect.isTrue(funObjTyp is FunObjTyp); | |
| 35 Expect.isTrue(funObjTyp is FunTypTyp); | |
| 36 | |
| 37 Expect.isTrue(funTypTyp is! FunObjObj); | |
| 38 Expect.isTrue(funTypTyp is! FunTypObj); | |
| 39 Expect.isTrue(funTypTyp is! FunObjTyp); | |
| 40 Expect.isTrue(funTypTyp is FunTypTyp); | |
| 41 } | |
| OLD | NEW |